Change:
Type: <bBug</bIt seems like VSCode doesnt know how to read Razor syntax, which is weird since Microsoft developed razor/blazor... Jetbrains Rider seems to get this 100%, colors for semantic/syntax highlighting work accurately. How is this possible? Even the default themes dont correct this? No extensions to fix this? VSCode: ! Rider: ! VS Code version: Code 1.72.0 (, 2022-10-04T23:19:55.212Z) OS version: Darwin arm64 21.6.0 Modes: Sandboxed: No <details<summarySystem Info</summary </details<details<summaryExtensions (133)</summaryExtensionVersion ------ better-comments3.0.2 codesnap1.3.4 add-reference1.0.2 asp-net-core-switcher2.0.2 blazor-snippet-pack2.6.1 format-selection-as-html2.3.0 namespace1.1.2 user-secrets2.0.1 razor-snippets-for-asp-net-core0.0.3 project-manager12.7.0 ng-template14.2.0 vscode-color-picker0.0.4 swagger-viewer3.1.2 markdown-emoji0.3.0 markdown-preview-github-styles1.0.1 vscode-tailwindcss0.8.7 xml2json1.2.4 npm-intellisense1.4.2 path-intellisense2.8.1 js-codeformer2.6.1 jsrefactor3.0.1 codeswing0.0.21 gitignore0.9.0 csharp-interpolated-string-converter0.1.6 supersharp0.1.4 csharpier-vscode1.3.5 vscode-mysql-client25.8.6 angular-schematics5.2.6 csharp-grammar-extended1.1.1 vscode-markdownlint0.48.1 vscode-eslint2.2.6 vscode-dotnet-auto-attach1.1.1 quicktype-refresh1.0.2 githistory0.6.19 xml2.5.1 es7-react-js-snippets4.4.3 vscode-babel-coloring0.0.4 vscode-html-css1.13.1 EditorConfig0.16.4 vscode-nupkg1.0.1 prettier-vscode9.9.0 font-switcher4.1.0 git-project-manager1.8.2 scaffold1.0.0 auto-close-tag0.5.14 auto-complete-tag0.1.0 auto-rename-tag0.1.10 code-runner0.11.8 dotnet0.0.4 dotnet-test-explorer0.7.8 asp-net-core-switcher2.0.2 auto-using0.7.15 vscode-angular-html1.8.4 remotehub0.44.0 vscode-pull-request-github0.50.0 live-sass5.5.1 vscode-semistandard-format0.0.9 rest-client0.25.1 blazorNewComponent1.0.0 output-colorizer0.1.2 mysql-syntax1.3.1 search-node-modules1.3.0 markdown-extended1.1.3 nuget-reverse-package-search0.1.68 vscode-csharp-snippets1.1.0 roslynator4.1.1 docomment0.1.31 aspnetcorerazor-html-css-class-completion1.0.3 wordcounter2.4.3 dotnet-core-essentials0.0.8 vscode-gutter-preview0.30.0 csharpextensions1.7.3 dotnet1.3.0 next-js-ts-snippets2.0.3 csharp-colors0.1.8 MagicPython1.1.0 json-to-ts1.7.5 vscode-pdf0.0.6 dotnet-core-commands1.0.6 rainbow-csv3.2.0 vscode-language-babel0.0.36 git-graph1.30.0 gitignore1.0.1 xml-format1.1.3 vscode-scss0.10.0 blazorwasm-companion1.1.0 csharp1.25.0 dotnet-interactive-vscode1.0. vscode-dotnet-runtime1.5.0 jupyter2022.9. js-debug-nightly2022.10.617 live-server0.4.3 remote-repositories0.22.0 vscode-typescript-next4.9. vscode-dotnet-watch1.1.8 color-highlight2.5.0 gremlins0.26.0 vscode-extension-auto-import1.4.3 indent-rainbow8.3.1 es6-css-minify3.3.3 vscode-nuget-gallery0.0.24 vscode-versionlens1.0.10 vscode-gitignore-generator1.0.3 material-product-icons1.4.1 Csharp-ASPNETCore1.11.0 vscode-thunder-client1.19.7 vscode-xml0.21. vscode-yaml1.10.1 csharp-snippet-productivity1.3.0 LiveServer5.7.9 csharp-helper0.0.14 blazorsnippets1.5.1 markdown-preview-enhanced0.6.3 vscode-scss-formatter2.4.3 code-spell-checker2.10.1 Blazor-VSCode-Extensions20.3.47 msbuild-project-tools0.4.9 vscode-mdx1.0.3 refactor-css0.4.2 errorlens3.6.0 vscodeintellicode1.2.28 image-viewer1.3.2 file-icons-mac1.0.1 vscode-import-cost3.3.0 dotnetboost0.1.2 better-align1.1.6 JavaScriptSnippets1.8.0 ReactSnippets2.4.0 vscode-mdx-preview0.3.3 markdown-all-in-one3.4.3 json2.0.2 mdx-blog-post0.0.1 vscode-open-in-github1.3.6 (2 theme extensions excluded) </details<!-- generated by issue reporter --
can you share a copy/pastable snippet that I can use to reproduce the issue you're seeing?
The screenshots show the initial template used to create a new .net6 blazor wasm (not hosted) project. So essentially the stock project created when starting a new blazor wasm app. No code , just standard boilerplate code from project template. .net6, blazor wasm, not hosted, created using visual studio 2022 for mac. This is the fetchData razor page code:
So weird that github managed to add some syntax to that bit of code. this is cobalt2 theme in vscode: <img width="926" alt="Screenshot 2022-10-10 at 17 56 42" src="https://user-"
Thanks for the snippet. We used to get our Razor syntax highlighting grammar from but that repository is gone. I'll take this as a feature request to find another Razor grammar to use.
Thanks. Sad to see that this issue has been around for more than 3 years... Not holding my breath for a solution here as this doesnt seem to be particularly high on anyone's to-do list... But here's hoping something comes from this. Best solution now is to use JetBrains Rider until this is sorted.
Let's see if there's any objection to
Is there not a Razor syntax highlighter extension on the marketplace?
None I could find. Googling it also pointed me towards one extension that hasnt been worked on in 4 years and was useless. But it should really be a vscode feature don't you think? Microsoft should at least have support for their products in their own code editor? Anyway, it will get figured out I'm sure.
Verified through integration tests.

Discussion:
return grammar; } <del> const razorGrammarRepo = 'OmniSharp/omnisharp-vscode'; const grammarPath = 'src/razor/syntaxes/aspnetcorerazor.tmLanguage.json'; vscodeGrammarUpdater.update(razorGrammarRepo, grammarPath, './syntaxes/cshtml.tmLanguage.json', grammar => patchGrammar(grammar)); </del> <ins> const razorGrammarRepo = 'dotnet/razor-tooling'; const grammarPath = 'src/Razor/src/Microsoft.AspNetCore.Razor.VSCode.Extension/syntaxes/aspnetcorerazor.tmLanguage.json'; vscodeGrammarUpdater.update(razorGrammarRepo, grammarPath, './syntaxes/cshtml.tmLanguage.json', grammar => patchGrammar(grammar), 'main'); </ins>

"component": { "type": "git", "git": { <del> "name": "OmniSharp/omnisharp-vscode", "repositoryUrl": "https://github.com/OmniSharp/omnisharp-vscode", "commitHash": "85d6eeea14e9aef51934697de78c77fbddbf1aa8" </del> <ins> "name": "dotnet/razor-tooling", "repositoryUrl": "https://github.com/dotnet/razor-tooling", "commitHash": "558b502fbef5ecdf386ccd6d47b0b40b5f8800a7" </ins> } }, "license": "MIT", <del> "version": "1.24.0", </del> <ins> "version": "1.0.0", </ins> "licenseDetail": [ "MIT License", "",

{ "information_for_contributors": [ <del> "This file has been converted from https://github.com/OmniSharp/omnisharp-vscode/blob/master/src/razor/syntaxes/aspnetcorerazor.tmLanguage.json", </del> <ins> "This file has been converted from https://github.com/dotnet/razor-tooling/blob/master/src/Razor/src/Microsoft.AspNetCore.Razor.VSCode.Extension/syntaxes/aspnetcorerazor.tmLanguage.json", </ins> "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], <del> "version": "https://github.com/OmniSharp/omnisharp-vscode/commit/85d6eeea14e9aef51934697de78c77fbddbf1aa8", </del> <ins> "version": "https://github.com/dotnet/razor-tooling/commit/558b502fbef5ecdf386ccd6d47b0b40b5f8800a7", </ins> "name": "ASP.NET Razor", "scopeName": "text.html.cshtml", "patterns": [