Skip to content

Syntax Highlighting in attribute macros should consider the node #12842

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

Closed
Veykril opened this issue Jul 21, 2022 · 2 comments · Fixed by #12844
Closed

Syntax Highlighting in attribute macros should consider the node #12842

Veykril opened this issue Jul 21, 2022 · 2 comments · Fixed by #12844
Labels
A-highlighting (semantic) token highlighting

Comments

@Veykril
Copy link
Member

Veykril commented Jul 21, 2022

Highlighting currently just picks the first token mapping it finds and applies that as that is simple and fast. This has the problem that code in attributes may become very chaotic if the spans are used a lot.
See this snippet without the database attribute
image
and here with it (Note the self parameter and function name colors changing)
image

Syntax highlighting should attempt to prioritize a mapping that fits the input node syntactically and only pick a different one if there is no similar node to it.

@Veykril Veykril added the A-highlighting (semantic) token highlighting label Jul 21, 2022
@bors bors closed this as completed in 7e30ca1 Jul 22, 2022
@lnicola
Copy link
Member

lnicola commented Jul 22, 2022

Looks like we don't resolve self here, is that expected?

@Veykril
Copy link
Member Author

Veykril commented Jul 22, 2022

Yes that is expected, salsa doesn't re-use the token span for the self parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-highlighting (semantic) token highlighting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants