-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript / JavaScript syntax highlighting changes after a few seconds #92308
Comments
Can confirm. Using the Monokai theme, after the Javascript/Typescript Language Features finish loading my syntax highlighting gets all jacked up. Reverted to 1.42.1 and it works. Same info as OP **EDIT: Spelling is hard |
Same issue here. I rolled back to v 1.4.2 using this link: https://code.visualstudio.com/updates/v1_42 Screenshots using my theme Bio Dark (https://marketplace.visualstudio.com/items?itemName=studiobio.bio-dark-theme) ^^ in the v 1.4.3 update functions are yellow and the jQuery $ is orange. They shouldn't be. Nothing was changed in my theme. VSCode should respect the theme's syntax highlighting. v 1.4.3 is overriding the theme. |
In the last update, a feature called Typescript Semantic Highlighting was introduced, which is turned on by default and is what caused the syntax highlighting changes, in all existing themes. A temporary workaround is to add this custom setting:
|
Aww man, that happens when you don't read the complete changelog u.u (my case), thx good man. |
You're welcome, glad to help you. I only knew what it was because I made a color theme |
Thanks for the info @MatiasOlivera Seems strange that you now need to set a custom setting to use themes without them breaking though. Is this something theme creators are going to be able to override or is this just a thing now? |
I updated this comment to avoid more misinformation. Sorry for the confusion, at first I thought the colors themes should use the "new identifiers" to solve the syntax highlighting problems. Well, I was wrong, because semantic highlighting doesn't add any new styles or colors and luckily theme authors are not going to have to update their themes to make them work with it. |
1.43.0 has another annoying thing for React: All 3 imports import { ModalForm, Field, MultiLangText } from './form2'; are React components, it doesn't matter if they are functional components (the first 2) or class components (last one), it's more distracting than useful to have them with different colors Can this change be reversed? |
@caub Are you using the Babel javascript extension? This extension uses identifiers that are different from the built-in ones. You can try disabling the extension, |
I am using the default VSCode theme bundled with VSCode. Did nobody test this before pushing out the release? |
Thank you! It was driving me insane! |
First, apologies for the confusion caused by the new semantic highlighting feature and thanks for everyone for taking the time to report. It's not that the themes have changed (or need updating), it's the input the themes get that has been augmented. It's still passed in the same form (TextMate scopes, e.g. To understand what has changed, set the cursor on a symbol and invoke the Many users have asked for semantic highlighting and have been looking forward to it but I realize that the color changes leaves many users puzzled and even see it as a bug. I will discuss in the team what the best default setting for semantic highlighting is. To turn off semantic highlighting use: If you like semantic highlighting but feel that classifications are wrong, please use the |
semanticHighlighting is awesome, it looks wrong now without it. |
This new setting It's going to break a lot of peoples color schemes and cause headaches for people who have themes in the VSCode Marketplace. Not everybody is going to read through support Issues to figure this out. |
Semantic highlighting seems like a cool feature and as a theme creator (and user), I'd like to fully support it in my theme. All that said, no one at Microsoft or the VSCode team thought to inform theme creators about this change before rolling it out unilaterally? I use VSCode for my day-to-day work and can't afford to run the sometimes unstable insider builds which I subscribed to for a while until reverting back to the stable builds. Other than using insider builds, how are/were we supposed to know about this change? More broadly, I love VSCode and applaud new features and innovations but in cases like this, a little foresight and communication could go a long way. Instead of every theme creator now scrambling, this could have been avoided with a simple email notifying theme devs about this upcoming change and to get our themes ready before v1.4.3 was released. |
@selfrefactor stable, 1.43.1, but - as @atomiks said you have to explicitly enable it. "editor.tokenColorCustomizations": {
"semanticHighlighting": true
}, |
Ignore this comment. This is apparently a feature, as stated in #92740. I have just updated to Everything looks more or less the same in my I have tried enabling/disabling semantic highlighting using the editor options above, both for all themes and for the currently used only, to no avail. Is there any way to bring back syntax highlighting in import statements? I have to say, I always keep an eye out on future changes by loading my projects in the insiders version of vscode, so this is a change I was expecting. I'd like to ask for help first, though, before reverting back to |
@davelsan Did you also try |
Ignore this comment. This is apparently a feature, as stated in #92740.
Hey, thanks for looking into this. Yes, that was actually the first thing I tried (as per an earlier comment in this issue). I have since my previous comment reverted to The picture below is the inspector window using The next picture is the inspector window using However, for the second picture, semantic highlighting is explicitly enabled in {
"editor.tokenColorCustomizations": {
"semanticHighlighting": true,
"[Default Dark+]": {
"semanticHighlighting": true
}
}
} There are also syntax highlighting differences between both I believe this might qualify as a bug report? Edits: Clarifications and typos. |
The latest update today(1.43.1) just broke it again. I've tried enabling it and disabling it but nothing works. I've tried the putting it in "editor.tokenColorCustomizations" and it still wont work... I want to revert back to 1.43.0 but can't find a download link anywhere. Anyone know how to revert back? |
@joshbang, you can download a previous minor version using the download address of the current version.
For example, to download the |
@joshbang What exactly is broken for you? |
@davelsan I think I'm an idiot, because when I copy the 64 bit download link, it copies "https://code.visualstudio.com/Download" to the clipboard. But thanks for providing the link for me! |
@aeschli It is having the same problem as the post originally had. Some of the colors on my color theme got messed up again once I upgraded to today's version(1.43.1). I tried enabling and disabling semantic highlighting again and I've tried copying and pasting
Into there. I've also tried changing all the values to false. But changing them to true gets me closer, but not all the way there. Edit: I will say that adding this fixed some things but when I try and set something to $scope(I'm using angularjs), the $scope doesn't get highlighted. Edit2: When using a parameter from a function, those don't get highlighted. Ex. name doesn't get highlighted but testVariable does. |
Semantic highlighting is the exact opposite for me, having to work with JS codebases that do not use ES classes, but still use custom 'class' factories to generate constructor functions which are assigned to variables or constants. Without semantic highlighting, those will show up appropriately colored when used with And that's not the only case of TypeScript having insufficient information to give an accurate token and instead it just tosses out something nonsensical, which the new semantic highlighting then still takes as a greater truth over the TextMate grammar that -- actually -- was more correct. This really, really, REALLY needs a big pile of improvement, outside of what TypeScript's language server can currently give or do. The semantics TypeScript gives should be checked against the syntax. And if the syntax indicates another purpose and the semantics are not strong enough, the syntax should overrule the semantics. (And possibly apply with back-pressure to other occurences of the same token as well; which would be nice.) Quite possibly this means the TypeScript language server and the spec for semantic tokens need to be updated to be able to communicate whether a token class is a strong "know" or a weak "guess" as well. It's either going to have to be something like that -- or it'll have to be a per-language kill-switch, instead of a global switch that turns it off for all languages. This can be potentially useful for other languages which don't screw the pooch as badly as TypeScript-applied-to-JavaScript currently does, but there's no way in hell I'm switching it back on if that remains as badly broken as it is today. |
@rjgotten I did a quick test, not seeing sea of monotone? I am using the latest VS Code 1.43.1 version and official theme: // Class
class Example {
public x;
public y;
constructor(x, y) {
this.x = x;
this.y = y;
}
method() {
console.log(2);
}
}
// Factory
const Example2 = (x, y) => {
return {
x,
y,
method() {
console.log(1);
}
};
};
const example = new Example(1, 2);
const example2 = Example2(1, 2); |
@rjgotten Can you file a new issue so I can investigate? Screenshots are great but please always add a code snippet as well. @webappslove That's #91090. @joshbang In 1.43.1, if you use a custom theme (like |
@aeschli |
We have the syntax issue much worse, and adding that line to the settings did not help. This seems to relate to The rest of the file is green. The FixWe fixed this fully by reverting from vscode insiders to standard vscode. Versions
|
@dawsbot That seems to be an issue unrelated to semantic highlighting. Can you file a new issue with the a code sample to reproduce? |
Closing this issue given the changes pushed for 1.43.1 described in #92740. |
EDIT: I created https://github.com/microsoft/vscode/issues/93176 as a follow-up. Thanks @aeschli ! @aeschli Upon disabling I've created this gist for you to easily replicate our issue. Thanks! |
I just updated and my javascript syntax highlighting broke.
Does this issue occur when all extensions are disabled?: Yes
EDIT: I rolled back to January. Much better now
Edit by @aeschli (VSCode team):
What you see is the new semantic highlighting feature updating the highlighting with resolved information from the TypeScript server. The server takes a while to load, depending on the size of the project, that's why the highlighting comes in delayed.
As a result, each identifier gets colored & styled with the color of the symbol it resolves to. You can see this the easiest in the imports where you can now see what is a function, variable or type. Another example are that readonly variables ('consts') and members can get a different style that modifiable variables, if the theme has defined different colors & styles.
There are still bugs with the way symbols are classified (e.g.
resolve
and other symbols that are both function and object), but the color changes as such are intended.We're still debating what the best default setting for semantic highlighting is as many see the updated colors as a bug.
You can turn the semantic highlighting feature off with
"editor.semanticHighlighting.enabled": false
I created https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview#semantic-highlighting with the planed changes for this weeks stable fix release (1.43.1):
We will only enable semantic highlighting by default for the built-in themes. Other themes can opt-in (or it can be enabled in the user settings).
The text was updated successfully, but these errors were encountered: