microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.58k stars 29.03k forks source link

TextMate Scope for `>` in <script> wrong when attribute used #231691

Open yenmangu opened 2 days ago

yenmangu commented 2 days ago

Type: Bug

I have noticed that the textmate scope for the closing > bracket in the open <script> tag is not recognised as anything beyond html-template.ng when there is an attribute or indeed as soon as a space is iincluded after the script

<script src="..."></script>

This fundamentally breaks the syntax highlighting and indeed any of the highlighting of any script inserted between the opening and closing tags.

I have produced a mnimally reporducible just with this:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta
            http-equiv="X-UA-Compatible"
            content="IE=edge" />
        <meta
            name="viewport"
            content="width=device-width, initial-scale=1.0" />
        <title>Simple Website</title>
        <link
            rel="stylesheet"
            href="main.css" />
    </head>
    <body class="light-theme">
        <script src="..."></script>
    </body>
</html>

Image

VS Code version: Code 1.94.2 (Universal) (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z) OS version: Darwin x64 24.0.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz (8 x 2300)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|7, 8, 9| |Memory (System)|8.00GB (1.81GB free)| |Process Argv|. --crash-reporter-id d18fc757-fda0-450a-9e6b-704098885aea| |Screen Reader|no| |VM|0%|
Extensions (119) Extension|Author (truncated)|Version ---|---|--- terraform|4op|0.2.5 vscode-nginx-conf|ahm|0.3.5 Bookmarks|ale|13.5.0 ng-template|Ang|18.2.0 ACF-Snippet|ant|1.9.0 vscode-intelephense-client|bme|1.12.6 status|Bob|1.0.2 simple-react-snippets|bur|1.2.8 path-intellisense|chr|2.9.0 woocommerce|cla|1.1.0 wpcs-whitelist-flags|cla|1.1.0 csharpier-vscode|csh|1.8.0 vbscript|Dar|1.0.4 vscode-eslint|dba|3.0.10 javascript-ejs-support|Dig|1.3.3 githistory|don|0.6.20 xml|Dot|2.5.1 es7-react-js-snippets|dsz|4.4.3 bracket-pair-toggler|dzh|0.0.3 gitlens|eam|15.6.2 vscode-html-css|ecm|2.0.10 prettier-vscode|esb|11.0.0 auto-rename-tag|for|0.1.10 code-runner|for|0.12.2 html-snippets|gey|0.2.3 vscode-angular-html|gha|2.13.0 vscode-pull-request-github|Git|0.98.0 selected-lines-count|gur|1.4.0 terraform|has|2.33.0 minify|Hoo|0.4.3 rest-client|hum|0.25.1 angular2-switcher|inf|0.4.0 ejs-beautify|j69|1.0.6 search-node-modules|jas|1.3.0 better-cpp-syntax|jef|1.27.1 angular-essentials|joh|18.0.0 Angular2|joh|18.0.2 vscode-peacock|joh|4.2.2 cmake-language-support-vscode|jos|0.0.9 ejs-eval|kev|1.0.2 vscode-liquid-snippets|kil|2.0.3 shopify-liquid-preview|kir|2.1.0 jsdoc|lll|1.0.9 vscode-lottie|lot|1.0.5 rainbow-csv|mec|3.12.0 Angular-BeastCode|Mik|17.0.4 prettify-json|moh|0.0.3 mongodb-vscode|mon|1.9.1 selected-character-count|mou|0.0.1 vscode-apache|mrm|1.2.0 vscode-autoprefixer|mrm|3.0.1 vscode-scss|mrm|0.10.0 vscode-docker|ms-|1.29.3 csdevkit|ms-|1.11.14 csharp|ms-|2.50.27 vscode-dotnet-runtime|ms-|2.2.0 vscodeintellicode-csharp|ms-|2.1.11 debugpy|ms-|2024.12.0 python|ms-|2024.16.1 vscode-pylance|ms-|2024.10.1 jupyter|ms-|2024.9.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.388.0 remote-ssh|ms-|0.115.0 remote-ssh-edit|ms-|0.87.0 remote-wsl|ms-|0.88.4 cmake-tools|ms-|1.19.52 cpptools|ms-|1.22.9 cpptools-extension-pack|ms-|1.3.0 hexeditor|ms-|1.10.0 remote-explorer|ms-|0.4.3 vscode-serial-monitor|ms-|0.13.1 sqltools|mtx|0.28.3 angular2-inline|nat|0.0.17 php-docblocker|nei|2.7.0 indent-rainbow|ode|8.3.1 material-icon-theme|PKi|5.11.1 postman-for-vscode|Pos|1.3.0 vscode-css-peek|pra|4.4.1 vscode-yaml|red|1.15.0 shellman|Rem|5.7.0 LiveServer|rit|5.7.9 synthwave-vscode|Rob|0.1.15 snippets-ranger|rob|1.8.0 mongo-snippets-for-node-js|roe|1.3.12 vbsvscode|Ser|1.2.1 firacode|Sey|2.2.2 theme-check-vscode|Sho|2.5.1 vscode-scss-formatter|sib|3.0.0 html5-boilerplate|sid|1.1.1 shopify-liquid|sis|4.0.1 vsc-quokka-statusbar|ske|1.3.6 reveal|smu|1.2.7 guides|spy|0.9.3 angular-template-formatter|str|0.1.5 vscode-stripe|str|3.2.8 ejs-snippets|Tao|0.1.0 ayu|tea|1.0.5 open-in-browser|tec|2.0.0 savecode|thi|0.1.4 vscode-status-bar-format-toggle|tom|3.2.0 rename-angular-component|tom|3.0.0 cmake|twx|0.0.17 highlight-matching-tag|vin|0.11.0 vscode-nginx|wil|0.7.2 lottie-viewer|wil|0.0.1 wordpress-toolbox|wor|1.3.15 JavaScriptSnippets|xab|1.8.0 clang-format|xav|1.9.0 php-debug|xde|1.35.0 primeflexsnippets|yig|1.0.3 primengsnippets|yig|1.0.5 markdown-all-in-one|yzh|3.6.2 material-theme|zhu|3.17.5 html-css-class-completion|Zig|1.20.0 php-intellisense|zob|1.3.3 (6 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 vscaat:30438848 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 jg8ic977:31013176 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 nativerepl1:31139838 refactort:31108082 pythonrstrctxt:31112756 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 autoexpandse:31146404 iacca1:31156133 notype1cf:31157160 5fd0e150:31155592 dwcopilotcf:31161678 iconenabled:31158251 ```
RedCMD commented 1 day ago

I cannot confirm Image

do you have any other injection extensions installed?

yenmangu commented 1 day ago

It seems this is not limited to .html

I am currently going through an ASP.NET course on Microsoft and it seems there is syntax highlighting issues with their own examples.

The following is screen shotted from https://learn.microsoft.com/en-gb/training/modules/create-razor-pages-aspnet-core/4-exercise-add-new-razor-page

Image

@RedCMD I have nothing else other than what is included in my system information in the original issue

RedCMD commented 1 day ago

Caused by your extension vscode-angular-html Image