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

Show CSS code hints in SCSS mode. #4931

Merged
merged 3 commits into from
Sep 4, 2013
Merged

Show CSS code hints in SCSS mode. #4931

merged 3 commits into from
Sep 4, 2013

Conversation

RaymondLim
Copy link
Contributor

This works for all valid CSS properties except those syntax that are not yet supported in CodeMirror SCSS mode.

eg. border: { style: solid; } You won't see property values for border-style when the cursor is after style: in the example. Instead, you see a list of property names since CodeMirror does not recognize style: as a nested property.

@JeffryBooher
Copy link
Contributor

@RaymondLim SCSS supports both the single line comment // and multi-line comments /*..*/ which may not work with our internal parsers. I know the code that I wrote for removing comments for named flows doesn't support it so I'm wondering if there are others. This apparently is also an issue with .less files.

@RaymondLim
Copy link
Contributor Author

@JeffryBooher Thanks for your info on comments in SCSS. I tested both // and multi-line comments, CodeMirror color coding is working correctly with both types of comments. So they don't have any impact on our CSS code hints -- commented property won't get any hints, but those not in any comment will get correct hints.

Update: just realize your concern of collecting named flows from single line comments in SCSS files since you don't have it implemented. AFAIK, this is the only thing that is not relied on CodeMirror mode and you just have to fix it in your regular expression.

@ghost ghost assigned redmunds Aug 30, 2013
@redmunds
Copy link
Contributor

redmunds commented Sep 3, 2013

This looks good, except there is 1 EditorOptionHandlers Unit test failing:

should style active line after turning it on

TypeError: Cannot call method 'hasSelection' of null
    at Function.Editor.setShowActiveLine (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/src/editor/Editor.js:1578:20)
    at Command._toggleActiveLine [as _commandFn] (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/src/editor/EditorOptionHandlers.js:52:16)
    at Command.execute (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/src/command/CommandManager.js:90:38)
    at Object.execute (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/src/command/CommandManager.js:245:36)
    at null.<anonymous> (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/spec/EditorOptionHandlers-test.js:190:46)
    at jasmine.Block.execute (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/thirdparty/jasmine-core/jasmine.js:1024:15)
    at jasmine.Queue.next_ (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/thirdparty/jasmine-core/jasmine.js:1842:31)
    at jasmine.Queue.start (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/thirdparty/jasmine-core/jasmine.js:1795:8)
    at jasmine.Spec.execute (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/thirdparty/jasmine-core/jasmine.js:2122:14)
    at jasmine.Queue.next_ (file:///C:/Users/redmunds/github/brackets-shell/Release/dev/test/thirdparty/jasmine-core/jasmine.js:1842:31)

Maybe you just need to merge with master?

@RaymondLim
Copy link
Contributor Author

Thanks @redmunds

Merging with master indeed fixes this unit test failure.

@RaymondLim
Copy link
Contributor Author

@redmunds ready for re-review. I'm including unit test failure fix (for #5051) with this pull request since the fix is on the same return statement that this pull request touches.

return (state.stack[state.stack.length - 1] === "propertyValue" && state.stack[state.stack.length - 2] === "rule");
return ((state.stack[state.stack.length - 1] === "propertyValue" &&
(state.stack[state.stack.length - 2] === "rule" || state.stack[state.stack.length - 2] === "block")) ||
(state.stack[state.stack.length - 1] === "(" && (state.stack[state.stack.length - 2] === "propertyValue")));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line fixes the unit test failure caused by latest CodeMirror update.

@redmunds
Copy link
Contributor

redmunds commented Sep 4, 2013

All test now pass (Win7). Merging.

redmunds added a commit that referenced this pull request Sep 4, 2013
Show CSS code hints in SCSS mode.
@redmunds redmunds merged commit 3ce6ae2 into master Sep 4, 2013
@jasonsanjose jasonsanjose deleted the rlim/hints-for-scss branch September 4, 2013 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants