Skip to content

Syntax highlighting issue ("templates/**/*") #15091

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
vblinden opened this issue Jun 19, 2023 · 18 comments · Fixed by #15102
Closed

Syntax highlighting issue ("templates/**/*") #15091

vblinden opened this issue Jun 19, 2023 · 18 comments · Fixed by #15102
Labels
A-highlighting (semantic) token highlighting C-bug Category: bug

Comments

@vblinden
Copy link

rust-analyzer version: rust-analyzer version: 0.3.1557-standalone (cd3bf9f 2023-06-18)
rustc version: rustc 1.70.0 (90c541806 2023-05-31)

Hi,

I'm running into an issue where syntax highlighting is not correctly working for "templates/**/*". Somehow the editor thinks this is a comment and makes everything greyed out (because of /**).

This is inside a string so it shouldn't be considered a comment.

Some screenshots:

image

image

@vblinden vblinden added the C-bug Category: bug label Jun 19, 2023
@lnicola
Copy link
Member

lnicola commented Jun 20, 2023

Does it look fine if you use Tera::new("templates/**/*").unwrap(), as you probably should? What about if you comment out #[actix_web::main]?

@vblinden
Copy link
Author

It does not matter. If I try other themes, the syntax highlighting issue remains.

image

image

@lnicola
Copy link
Member

lnicola commented Jun 20, 2023

Which theme is that? Can you also show your extension list?

@vblinden
Copy link
Author

The theme is GitHub Dark (but any will do).

Extension list:

aaron-bond.better-comments
alefragnani.project-manager
BeardedBear.beardedicons
BeardedBear.beardedtheme
bierner.lit-html
bierner.markdown-mermaid
bmewburn.vscode-intelephense-client
bradlc.vscode-tailwindcss
BriteSnow.vscode-toggle-quotes
bungcip.better-toml
christian-kohler.npm-intellisense
dbaeumer.vscode-eslint
donjayamanne.githistory
eamodio.gitlens
EditorConfig.EditorConfig
esbenp.prettier-vscode
GitHub.copilot
GitHub.copilot-chat
GitHub.github-vscode-theme
golang.go
junstyle.php-cs-fixer
karunamurti.tera
MehediDracula.php-namespace-resolver
mikestead.dotenv
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.live-server
ms-vscode.remote-explorer
ms-vscode.remote-server
ms-vsliveshare.vsliveshare
Natizyskunk.sftp
onecentlin.laravel-blade
persoderlind.vscode-phpcbf
Prisma.prisma
redhat.vscode-yaml
rust-lang.rust-analyzer
streetsidesoftware.code-spell-checker
streetsidesoftware.code-spell-checker-dutch
usernamehw.errorlens
vadimcn.vscode-lldb
VisualStudioExptTeam.intellicode-api-usage-examples
VisualStudioExptTeam.vscodeintellicode
vscodevim.vim
whatwedo.twig
yoavbls.pretty-ts-errors
zhuangtongfa.material-theme

The error will be triggered by just this:

let foo = "/**";

If I disable all extensions, it works correctly. If I enable only rust analyzer, it fails

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

concat is an eager macro so thats most likely whats breaking things here. Odd that this completely messed with everything after the call though and justthe call ..

@lnicola
Copy link
Member

lnicola commented Jun 20, 2023

No, it's not concat!, I think it's a recent regression.

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

Oh sorry I didn't check the later replies. Might be doc comment markdown injection messing up somehow?

@lnicola
Copy link
Member

lnicola commented Jun 20, 2023

I can reproduce this:

image

but only right after load. If I wait a little, I see:

image

This is because my test project has bevy as a dependency, which makes us take 15-30 seconds (!) for the initial diagnostics and syntax highlighting.

I also thought it was the Markdown PR or the aaron-bond.better-comments, but those seem unrelated.

@vblinden
Copy link
Author

If I use a freshly created Cargo project (and another theme (Light (Visual Studio)). And only enable rust-analyzer extension:

image
^ it stays like this forever.

If I then disable rust-analyzer:
image

The syntax highlighting is fixed, but I am sad I don't have rust-analyzer 😄

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

So this is either semantic highlighting causing this (which I doubt it is) or the markdown injection is doing wrong things (which I am more inclined to believe).

@Veykril Veykril added the A-highlighting (semantic) token highlighting label Jun 20, 2023
@lnicola
Copy link
Member

lnicola commented Jun 20, 2023

Or we fail the first highlighting request for some reason, and Code doesn't update its display.

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

This is the markdown injection causing problems, note how the semicolon is tagged with markdown
image

@tuxmark5
Copy link

tuxmark5 commented Jun 20, 2023

I have a similar issue where comments like /******/ cause anything that follows to have broken syntax highlighting. This started happening today:

image

Removing this bit from package.json fixes the issue:

{
    "scopeName": "rustdoc.markdown.injection",
    "path": "rustdoc.markdown.injection.tmGrammar.json",
    "injectTo": [
        "source.rust"
    ],
    "embeddedLanguages": {
        "meta.embedded.block.markdown": "text.html.markdown"
    }
}

In my case i had to remove it from containers ~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1557-linux-x64/package.json, as I use docker dev container

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

That one is expected, as doc comments are now treated as markdown, parens, braces and bracktes will benefit from the rainbow bracket highlighting

@tuxmark5
Copy link

@Veykril How can it be expected if the code below the comment isn't part of that comment? The comment in the screenshot both starts and terminates in line 10. The lines 11 to 30+ shouldn't be affected.

@Veykril
Copy link
Member

Veykril commented Jun 20, 2023

Oh apologies, I didn't see the closing / 🤦‍♂️
That is the same issue as described here, its also the markdown injection

@OliverNChalk
Copy link

Can confirm a recent update broke syntax highlighting in all files that contain this non-standard (but valid) header comments:
image

This is the minimal repro version:
image

@OliverNChalk
Copy link

For those affected by this using VSCode or derivative, you can rollback to the previous version:
image

image

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants