Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Limit QuickView to literal color names in some languages #8156

Merged
merged 8 commits into from
Sep 4, 2014

Conversation

marcelgerber
Copy link
Contributor

For #6836.
Limits QuickView to only literal color names in JS (including JSON), PHP and CoffeeScript.
Includes Unit tests and one new test file.

@peterflynn
Copy link
Member

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...

@marcelgerber
Copy link
Contributor Author

On words, you'll still get a popover (right now). It's currently only disabled for object/array keys and functions.

@redmunds
Copy link
Contributor

Definitely want something along these lines. Triage Complete.

@redmunds
Copy link
Contributor

@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.

@marcelgerber
Copy link
Contributor Author

@redmunds That's ok. But btw, this check is only executed after we have at least one result.
And we can too refactor it a little to only call getModeAt() after we got an actual result.

@marcelgerber
Copy link
Contributor Author

@redmunds @peterflynn FYI, I changed it to a whitelist with only CSS/SASS/SCSS/LESS in it.

@redmunds redmunds self-assigned this Jul 23, 2014
@@ -251,11 +255,24 @@ define(function (require, exports, module) {

return false;
}
function checkForLiteral(match) {
Copy link
Member

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"?

Copy link
Contributor Author

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"];
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@redmunds
Copy link
Contributor

Done with review.

@redmunds
Copy link
Contributor

redmunds commented Sep 4, 2014

Thanks. Merging.

redmunds added a commit that referenced this pull request Sep 4, 2014
Limit QuickView to literal color names in some languages
@redmunds redmunds merged commit 60ce7af into adobe:master Sep 4, 2014
@marcelgerber marcelgerber deleted the quick-view-literal branch September 5, 2014 00:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants