microsoft / microsoft/vscode-textmate
TextMate scope selectors: scope exclusion is not implemented
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 678
- Forks
- 135
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
From @monk-time on September 4, 2017 14:51
- VSCode Version: Code 1.15.1 (41abd21afdf7424c89319ee7cb0445cc6f376959, 2017-08-16T18:07:25.676Z)
- OS Version: Windows_NT x64 6.1.7601
- Extensions:
| Extension | Author (truncated) | Version |
|---|---|---|
| intellij-idea-keybindings | k-- | 0.2.13 |
| selectline-statusbar | tom | 0.0.2 |
Also the same result with today's VS Code Insiders build.
According to the documentation for TextMate scope selectors, VSCode supports the syntax for excluding matching scopes:
entity.name.method - source.javamatches all scopes that start withentity.name.methodbut not if a parent scope matchessource.java
This functionality is used in at least one built-in theme that I could find:
https://github.com/Microsoft/vscode/blob/c00bdb74ee665cccfc5c4e41520893bb19ef61e5/extensions/theme-monokai/themes/monokai-color-theme.json#L316
But it seems that this syntax makes the selector with - in it invalid, and VSCode doesn't apply the given rule to anything at all.
Steps to Reproduce:
- Put this rule for syntax highlighting in the settings. Confirm that comments turn yellow at least in some files.
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "comment",
"settings": {
"foreground": "#FFFF00"
}
}
]
}
}
- Change the line with the scope selector to:
"scope": "comment - source.js",
Expected result: comments that changed their color after step 1 remain yellow in all files except in.js.
Actual result: all comments reset to a color defined by the current theme.
Reproduces without extensions: Yes
Copied from original issue: Microsoft/vscode#33802
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files or tests. Start by reproducing the documented comment - source.js selector behavior with editor.tokenColorCustomizations, then locate the scope-selector parsing and matching code and its existing tests. Done means exclusion selectors apply to matching scopes except those under source.js, while ordinary selectors continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100