Skip to content

Conversation

@LucasSantos91
Copy link
Contributor

This enables coloring local and static variables differently:
color demonstration

It does not affect VS Code's default themes:
vscode demonstration

Copy link
Member

@Techatrix Techatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test coverage for semantic tokens should be updated. You can use zig build test -Dtest-filter="lsp_features.semantic_tokens" to run them.

I pushed a commit to your PR that should improve the error message from the tests when it reports incorrect token modifiers. Hope that helps.

Also be aware that this PR will need to be rebased if #2244 is merged.

@LucasSantos91
Copy link
Contributor Author

I've implemented all the tests.
I refactored my code and some of the code that was already present to decrease nesting.
I think I've got the logic to a good spot.
If we can determine that a token is either a type or a function, we don't add the static modifier, as it doesn't really make sense for them.
If the type cannot be determined, we decide whether to add the static modifier based solely on the scope of its declaration.
The only desirable thing that has not been added is that tokens of type .property don't inherit the static modifier from their parents. I could not find a way to do that without iterating up the chain of field accesses, like I had done previously.

@LucasSantos91 LucasSantos91 requested a review from Techatrix April 23, 2025 02:20
@LucasSantos91 LucasSantos91 requested a review from Techatrix April 27, 2025 14:48
Copy link
Member

@Techatrix Techatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for your work.

@Techatrix Techatrix merged commit ec42990 into zigtools:master Apr 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants