-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Limit QuickView to literal color names in some languages #8156
Conversation
I wonder if we should go further and switch to a whitelist -- respecting named colors only in CSS/LESS/SCSS files. I sometimes get the popover on words when editing plain .txt files, for example... |
On words, you'll still get a popover (right now). It's currently only disabled for object/array keys and functions. |
Definitely want something along these lines. Triage Complete. |
@dangoor @SAplayer After a closer look, I'm concerned about performance. Currently, a fair amount of Quick View processing is done during mousemove event processing and this adds a lot parsing using CodeMirror tokenizer. I don't think this pull request should be merged until the Defer most Quick View processing until after delay pull request has been merged. |
@redmunds That's ok. But btw, this check is only executed after we have at least one result. |
@redmunds @peterflynn FYI, I changed it to a whitelist with only CSS/SASS/SCSS/LESS in it. |
@@ -251,11 +255,24 @@ define(function (require, exports, module) { | |||
|
|||
return false; | |||
} | |||
function checkForLiteral(match) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by comment: "checkForLiteral()" is a name that leaves things vague about what's returned. Maybe something like "isNamedColor()"?
Similarly for "literalCheck" -- how about "disallowNamedColors" or "ignoreNamedColors"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -53,6 +54,8 @@ define(function (require, exports, module) { | |||
POINTER_HEIGHT = 15, // Pointer height, used to shift popover above pointer (plus a little bit of space) | |||
POPOVER_HORZ_MARGIN = 5; // Horizontal margin | |||
|
|||
var styleLanguages = ["css", "text/x-scss", "sass"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add LESS. FYI, In general Brackets plans to support scss, but not sass, but I guess it's OK if sass is accepted here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Done with review. |
Thanks. Merging. |
Limit QuickView to literal color names in some languages
For #6836.
Limits QuickView to only literal color names in JS (including JSON), PHP and CoffeeScript.
Includes Unit tests and one new test file.