Skip to content

fix: Add macro modifier for highlighting tokens in macro calls #14795

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

Merged
merged 1 commit into from
May 13, 2023

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented May 13, 2023

Followup to #14777 we have to tell the client about the semantic tokens inside macro calls as those can be remapped. Adding a modifier will force this behavior.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 13, 2023
@Veykril
Copy link
Member Author

Veykril commented May 13, 2023

@bors r+

@bors
Copy link
Contributor

bors commented May 13, 2023

📌 Commit 8e11685 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented May 13, 2023

⌛ Testing commit 8e11685 with merge e9f9bc2...

@bors
Copy link
Contributor

bors commented May 13, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing e9f9bc2 to master...

@bors bors merged commit e9f9bc2 into rust-lang:master May 13, 2023
@oxalica
Copy link
Contributor

oxalica commented May 31, 2023

This breaks my coc.nvim setup and it displays everything inside macro invocation as CocSemMacro highlighting, which is intended to highlight the macro itself. The issue is that the token modifier name macro collides with token type name macro. coc.nvim prefers modifiers against types, and it successfully found the highlighting for modifier macro defined as CocSemMacro (through it's originally for the type macro), thus it gets used always.

The solution could be:

  1. Define each type-modifier pair manually to override each back. This is tedious and impractical.
  2. Remove CocSemMacro highlighting definition, so it fallback to highlighting of token types. But I'll lose highlighting for macro itself foo!.
  3. Ask coc.nvim to use different highlighting groups to define colors of types and modifiers.
  4. Ask rust-analyzer to use a different name for types and modifiers.

I'm not quite sure on which side this should be fixed.

image

@Veykril
Copy link
Member Author

Veykril commented May 31, 2023

That sounds like a client bug to me. The client should not consider token types and token modifiers to be the same concept. They are very much separate entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants