Skip to content
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

&raw const/&raw mut is not syntax-highlighted in all files #19357

Closed
RalfJung opened this issue Mar 14, 2025 · 3 comments · Fixed by #19400
Closed

&raw const/&raw mut is not syntax-highlighted in all files #19357

RalfJung opened this issue Mar 14, 2025 · 3 comments · Fixed by #19400
Assignees
Labels
A-highlighting (semantic) token highlighting C-bug Category: bug E-easy E-has-instructions Issue has some instructions and pointers to code to get started

Comments

@RalfJung
Copy link
Member

RalfJung commented Mar 14, 2025

When opening a file that is not in the current project (i.e. RA cannot do its full semantic analysis), syntax highlighting of &raw is broken:

Image

Note that raw is not in the same style as mut.
raw is not a keyword, but its role as a contextual keyword in these expressions is entirely syntactic so this does not seem to me like it should require full type information to be properly highlighted.

rust-analyzer version: rust-analyzer version: 0.3.2337-standalone (5e7dd31 2025-03-09) [/home/r/.vscode-oss/extensions/rust-lang.rust-analyzer-0.3.2337-linux-x64/server/rust-analyzer]

editor or extension: VSCodium, extension v0.3.2337

code snippet to reproduce:

fn main() {
    let x = &raw mut 5;
}
@RalfJung RalfJung added the C-bug Category: bug label Mar 14, 2025
@ShoyuVanilla ShoyuVanilla added the A-highlighting (semantic) token highlighting label Mar 14, 2025
@Veykril
Copy link
Member

Veykril commented Mar 14, 2025

Technically that's an issue with the textmate grammar vscode ships. Though our semantic highlighting infra should handle this either way (which would fix it here)

@Veykril Veykril added the E-easy label Mar 14, 2025
@Veykril
Copy link
Member

Veykril commented Mar 14, 2025

Oh actually this should already work but does not because of

None => return hl.to_vec(),
early returning
We should make that krate an Option and actually generate the highlighting

@Veykril Veykril added the E-has-instructions Issue has some instructions and pointers to code to get started label Mar 14, 2025
@Shourya742
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-highlighting (semantic) token highlighting C-bug Category: bug E-easy E-has-instructions Issue has some instructions and pointers to code to get started
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants