Patch for CM5 native CSS nesting highlighting#4657
Open
Gazook89 wants to merge 2 commits intonaturalcrit:masterfrom
Open
Patch for CM5 native CSS nesting highlighting#4657Gazook89 wants to merge 2 commits intonaturalcrit:masterfrom
Gazook89 wants to merge 2 commits intonaturalcrit:masterfrom
Conversation
sets "allowNesting" to true for the CSS mode, and uses `patch-package` to maintain that through `npm install`s.
Member
|
Patching the npm package feels a bit sketchy. I can see the CSS mode doesn't expose the allowNested option, but can we do something like this in our codeMirror setup to kind of wrap the old CSS mode in a custom mode and change it there? |
Collaborator
Author
|
Yes that seems to work just fine. I tried to figure something out like that, but couldn't get it work, so thanks. Feel like a dummy. |
Member
Ok, in that case could you remove the patch-package dependency and then we can merge this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
As described in issue #4655 CM5 doesn't highlight nested selectors.
The CSS mode included with CM5 has two sub-modes,
x-LESSandx-SCSS, and they have aallowNestedproperty set to true. So I took that and popped it into the base CSS mode as well, and it worked.This adds
patch-packageto the dev dependencies, and after anynpm installit patchesnode_modules/codemirror/mode/cssto modify the CSS mode to includeallowNestedoption, set totrue.Could this be done in a cleaner way, perhaps by modifying the language mode within our editor instance? Maybe. I tried. I couldn't find where I could access or add a
allowNestedoption.There are a few other things we could modify in the css mode in the same way like newer css properties, selectors, etc. This is just a trail balloon, though.