Closed vanowm closed 6 months ago
Any changes in package.json
requires 2 restarts of vscode to take affect
Do the colours work on your language? (not the json file)
Currently I'm just piggy backing off vscodes scope highlighting (textmate)
it only takes the current themes colours/scopes into account
idk if the settings in package.json
modify's it
I might have to colour it with semantic highlighting
Yes, the colors are working properly in that extension. Two restarts of vscode??? That's doesn't sound like "real time" 😉
Tried it on fresh portable VSCode with default settings only this extension installed - it doesn't pick up any colors after multiple restarts:
the two restarts is default vscode behavior
you adding the scopes to your extension or theme? I only support themes scopes atm
It's syntax highlighting rules for the extension.
It is strange though that it's picking up some colors and not in fresh vscode
Its working for me
that's not the code from that branch thought
I just had a quick look it is indeed not working I'll have to figure it out later
seems only one extension can define editor.tokenColorCustomizations
at a time
I removed editor.tokenColorCustomizations
from my test extension and yours started working again
prob should make bug report to vscode
This doesn't affect just my extension it affects vscodes textmate in general
if you are launching your extension using vscodes debugging mode
then only one extension is modifying editor.tokenColorCustomizations
so it will appear to work correctly
you can see how I apply the scope to "name"
https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/eb83ff8104af2123cbe115b7fda2870d7693baf8/syntaxes/json.tmLanguage.json#L635
nothing special. just gets the text in "name"
and applies itself as a scope
its then up to the current theme (and textMateRules
) to colour it
keyboard shortcuts => editor.action.inspectTMScopes
Tried it on fresh portable VSCode with default settings only this extension installed - it doesn't pick up any colors after multiple restarts:
do you also have your extension enabled in the same instance of vscode?
On fresh install I only tested your extension, nothing else. P.S. On your screenshots, you are testing it against wrong commit/branch of autoit extension. For me as you can see on first screenshot, these names worked fine too, including names that ended with a color name (blue, red, brown), however on fresh install none are highlighted.
On fresh install I only tested your extension, nothing else.
vscode uses the current theme to colour in scopes your extension needs to be enabled for it to add your scopes to the current theme otherwise vscode will default back to standard white
I have both yours and my extension enabled in the same instance of vscode
I think there is misunderstanding 😉. My extension has nothing to do with this. When I open workspace where the code of my extension is in fresh vscode with only RedCMD installed, it doesn't show the colors.
which is currently intended behavior if your current theme doesn't support those scopes then they won't have any colour
maybe I can add a language feature to load scopes from inactivate extensions (semantic highlighting) problem is I have to manually check every file for it then I can't use any builtin vscode features and then what should happen when there is multiple workspaces and extensions? how to handle injections and embedding? manually emulating an environment is much harder than just using the current one is much simpler, as vscode handles everything
I didn't end up using semantic highlighting. VSCode's TextMate scopename assigning is way too stupidly complex
Instead I try to locate the package.json
file, copy the editor.tokenColorCustomizations
setting and apply it to VSCode's global settings file.
Sadly this will overwrite any editor.tokenColorCustomizations
thats already there
so I make a copy of that and save it as editor.tokenColorCustomizations_bak
and attempt to reload it back when closing files (TODO: needs more work https://github.com/microsoft/vscode/issues/201664)
In my tests, since we can't control when, which extension initializing first, all we can do is merge existing setting with ours, not just replace it. But again we can't really trust that the global setting is up-to-date when extension starts, even merging might not be 100% reliable solition...
I thought about merging all settings
But technically VSCode doesn't ever merge the editor.tokenColorCustomizations
setting either
so I'll just follow the same way and just temporary replace the settings when clicking on a package.json
file or json-textmate
languageId file
I don't have to worry about the extension initializing order as this feature is only for in the context that the extension providing the editor.tokenColorCustomizations
setting isn't loaded in the same instance of VSCode
I need to look into WorkspaceConfiguration.inspect()
, cause currently I'm backing up settings from loaded extensions rather than just the global settings file
I've published a pre-release version with the changes see if its like how you want and that theres no bugs :}
Now available in the full release 2.3.0 for VSCode 1.87.0
It seems changes in
package.json
are not reflected intmLanguage.json
And some scopes don't have any colors:I think it was one time after VSCode restart that is showed all the missing colors for a split of a second, then removed them.
[EDIT] might be conflicting with other extension? will check