I'm Ben and I write software, usually for work, sometimes for fun.
bkbooth / color-gutter Goto Github PK
View Code? Open in Web Editor NEWShow color swatches in the atom.io gutter
License: MIT License
Show color swatches in the atom.io gutter
License: MIT License
From https://discuss.atom.io/t/editor-isbufferrowcommented-not-working-on-first-load/11308/2?u=bkbooth
This method relies on tokens, which are created asynchronously, hence the issue if your code try to know if a line is commented before the tokenized buffer have been completely initialized.
# atom/atom/blob/master/src/editor.coffee#L473-L476
isBufferRowCommented: (bufferRow) ->
if match = @lineForBufferRow(bufferRow).match(/\S/)
scopes = @tokenForBufferPosition([bufferRow, match.index]).scopes
new TextMateScopeSelector('comment.*').matches(scopes)
You should try to hook onto the tokenized event on the displayBuffer of the editor prior to any access to methods that uses tokens.
In stylesheets/color-gutter.less: Style elements within text editors using the atom-text-editor::shadow
selector or the .atom-text-editor.less
file extension.
If you want to target overlay elements, target them directly or as descendants of atom-overlay
elements.
[Enter steps to reproduce:]
Atom: 1.21.1 x64
Electron: 1.6.15
OS: Mac OS X 10.13
Thrown From: color-gutter package 0.3.1
Failed to activate the color-gutter package
At Cannot read property 'command' of undefined
TypeError: Cannot read property 'command' of undefined
at Object.activate (/packages/color-gutter/lib/color-gutter.coffee:11:25)
at Package.module.exports.Package.activateNow (<embedded>:70734:25)
at <embedded>:70706:38
at Package.module.exports.Package.measure (<embedded>:70580:21)
at <embedded>:70699:32
at Package.module.exports.Package.activate (<embedded>:70696:40)
at PackageManager.activatePackage (<embedded>:23965:42)
at config.transactAsync (<embedded>:23940:36)
at Config.module.exports.Config.transactAsync (<embedded>:20835:24)
at PackageManager.activatePackages (<embedded>:23938:23)
at PackageManager.activate (<embedded>:23921:50)
at <embedded>:1092:36
autoprefixer 3.7.1
busy-signal 1.4.3
closure-linter 0.2.5
color-gutter 0.3.1
coverage-gutter 0.19.0
emmet 2.4.3
intentions 1.1.5
language-puppet 0.23.0
language-rust 0.4.12
linter 2.2.0
linter-clang 4.1.2
linter-codscriptizer 0.2.0
linter-cpplint 2.0.1
linter-csslint 2.0.0
linter-dekiscript 0.1.2
linter-erb 1.1.0
linter-flake8 2.2.1
linter-gjslint 1.5.2
linter-hlint 2.0.0
linter-htmlhint 1.3.4
linter-js-yaml 1.2.8
linter-jscs 4.1.3
linter-jshint 3.1.6
linter-jsl 0.0.1
linter-lua 1.0.4
linter-mcs 0.2.0
linter-metascript 0.0.5
linter-pep8 0.0.5
linter-php 1.5.1
linter-puppet-lint 0.8.3
linter-pycodestyle 2.1.3
linter-pyflakes 0.3.2
linter-rst 0.0.3
linter-rust 0.8.0
linter-scalac 1.4.4
linter-scss-lint 3.1.1
linter-tidy 2.3.1
linter-tslint 1.9.0
linter-ui-default 1.6.10
linter-write-good 0.9.0
merge-conflicts 1.4.5
seti-syntax 1.1.3
seti-ui 1.9.0
unity-dark-ui 2.0.9
I'm running Atom v0.187.0 under Ubuntu 14.04 LTS and when I open a CSS file with colors all over it I see no colors in the gutter.
Does this work only for LESS / SASS, or should it work also for plain old CSS ?
Deliberately don't want to show colour when block is folded, need to handle refresh when unfolding.
[Enter steps to reproduce below:]
Atom Version: 0.192.0
System: Mac OS X 10.10.3
Thrown From: color-gutter package, v0.4.1
Uncaught Error: This TextEditor has been destroyed
At /Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1022
Error: This TextEditor has been destroyed
at DisplayBuffer.module.exports.DisplayBuffer.screenPositionForBufferPosition (/Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1022:15)
at Marker.module.exports.Marker.getHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app/src/marker.js:176:33)
at new Marker (/Applications/Atom.app/Contents/Resources/app/src/marker.js:36:41)
at DisplayBuffer.module.exports.DisplayBuffer.getMarker (/Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1247:20)
at DisplayBuffer.module.exports.DisplayBuffer.markBufferPosition (/Applications/Atom.app/Contents/Resources/app/src/display-buffer.js:1287:19)
at TextEditor.module.exports.TextEditor.markBufferPosition (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1232:62)
at ColorGutterView.module.exports.ColorGutterView.markLine (/Users/norbert/.atom/packages/color-gutter/lib/color-gutter-view.coffee:76:22)
at ColorGutterView.<anonymous> (/Users/norbert/.atom/packages/color-gutter/lib/color-gutter-view.coffee:67:14)
at ColorGutterView.module.exports.ColorGutterView.updateColors (/Users/norbert/.atom/packages/color-gutter/lib/color-gutter-view.coffee:89:14)
at /Users/norbert/.atom/packages/color-gutter/lib/color-gutter-view.coffee:1:1
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:82:11)
at TextBuffer.module.exports.TextBuffer.applyPatch (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:550:20)
at BufferPatch.module.exports.BufferPatch.applyTo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/buffer-patch.js:57:21)
at Transaction.module.exports.Transaction.applyTo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/transaction.js:70:15)
at History.module.exports.History.abortTransaction (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:169:24)
at History.module.exports.History.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:126:16)
at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:647:27)
at TextEditor.module.exports.TextEditor.transact (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1107:26)
at atom-text-editor.newCommandListeners.(anonymous function) (/Applications/Atom.app/Contents/Resources/app/src/text-editor-element.js:304:22)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:238:29)
at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:519:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:354:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:180:20)
6x -1:46.6 core:backspace (atom-text-editor.editor)
2x -1:42.9 core:select-to-top (atom-text-editor.editor)
2x -1:41.5 core:select-to-bottom (atom-text-editor.editor)
-1:37.3 editor:select-to-first-character-of-line (atom-text-editor.editor)
-1:36.4 core:backspace (atom-text-editor.editor)
-1:34.5 core:undo (atom-text-editor.editor)
-1:24.5 settings-view:open (atom-text-editor.editor.is-focused)
-0:26.4 core:move-right (atom-text-editor.editor.is-focused)
-0:25.0 core:move-down (atom-text-editor.editor.is-focused)
-0:23.7 editor:consolidate-selections (atom-text-editor.editor.is-focused)
3x -0:18.7 find-and-replace:find-next (atom-text-editor.editor.is-focused)
-0:16.5 find-and-replace:select-next (atom-text-editor.editor.is-focused)
2x -0:14.5 editor:consolidate-selections (atom-text-editor.editor.is-focused)
-0:14.1 core:cancel (atom-text-editor.editor.is-focused)
-0:01.1 emmet:insert-formatted-line-break-only (atom-text-editor.editor.is-focused)
-0:01.1 editor:newline (atom-text-editor.editor.is-focused)
{
"core": {
"themes": [
"seti-ui",
"seti-syntax"
],
"audioBeep": false,
"projectHome": "Users/norbert/quince/"
},
"color-gutter": {}
}
# User
color-gutter, v0.4.1
color-picker, v1.6.0
emmet, v2.3.7
grunt-runner, v0.8.0
language-SCSS, v0.2.0
linter-scss-lint, v0.0.14
preview-plus, v1.1.19
project-colorize, v0.1.0
save-session, v0.13.5
seti-syntax, v0.3.3
seti-ui, v0.6.3
# Dev
No dev packages
Setup build with Travis CI
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.