-
Notifications
You must be signed in to change notification settings - Fork 222
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
Update semantic tokens #2168
Update semantic tokens #2168
Conversation
Thanks @MartinGC94 we would love to get this in but there may be delays in review/release as we are backlogged with other work |
@MartinGC94 do you regularly use the semantic highlighting feature? We turned it off by default after too many bug reports and too few resources to overhaul it. How has your experience been? |
@andyleejordan No, I hardly use VS code at all. I've just decided to give it another shot if I can get the syntax highlighting fixed. 1: Generic tokens are highlighted as functions: PowerShell/vscode-powershell#3997 and PowerShell/vscode-powershell#2860 The first one will be fixed by this PR. The third issue isn't really your problem to solve, though you can help a little. The problem demonstrated in: PowerShell/vscode-powershell#3221 where most elements turn blue is because the theme authors decided that variables and properties should both be blue but members should be yellow. Unfortunately there's no member semantic token so you have to pick between property and method. The way you could help would be to check if the next token is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This was small and to a feature we have off by default, so happy to merge.
793aed0
to
2bb4280
Compare
Ah, it looks like the unit tests need to be updated for these changes. |
Tests don't run automatically here? Thanks cryptobros for ruining free compute. |
Finally got around to doing it and found an error that I've now fixed. All tests now pass on my own machine at least. |
…abels. Also removes the incorrect Generic -> Function mapping.
c573418
to
2785754
Compare
Rebased to re-run tests, they should pass now that the supply chain stuff has been fixed up. |
Awesome, thanks both. Merging! |
@andyleejordan may want to enforce squash merges in the queue, this wasn't squashed so we have some slightly ugly commits in the tree now (not that it's that big a deal) |
I hate squash merging 😅 I'd rather have silly commits that are real than "oh we squashed and all your (pretty or not!) commits are gone." |
Fair enough, I'm still going to squash my PRs once they are ready (like that 200 commit rename one) so we can leave that to the PR author if you don't care from a main perspective. |
Exactly, and totally fine. If you want to squash commits do it! I don't like the blanket "squash everyone's commits" (especially since I personally craft usually a few indepenent hopefully well thought out commits...habits from patches on a mailing list days). |
PR Summary
Updates the semantic token mapping so attributes now get the "Decorator" token type and loop labels get the "Label" type. They seem to best match the mappings listed here: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers
I also removed the Generic -> Function mapping as I feel it does more harm than good to provide an inaccurate mapping. Unfortunately there's no fitting token for them, but feel free to give a thumbs up here: microsoft/vscode#97063 (comment) so it may get added in the future.
I didn't change this, but I see there's this mapping:
This seems wrong. The point of the syntax highlighting is to show what the parser sees, and if
SomeApp --Parameter
is not seen as a parameter by the parser then it shouldn't be highlighted as such. Can this be changed?Also is the token kind check really necessary here?
All the various operators have their own token kind and I can't think of a scenario where a generic token would have those those flags.
PR Context
I've been stubbornly holding on to ISE partially because of its superior syntax highlighting and while this doesn't fix it completely, it's a step in the right direction.