microsoft / vscode

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

Semantic Highlighting and Git Diff Side-by-Side #126722

Closed ecool closed 3 years ago

ecool commented 3 years ago

Issue Type: Bug

While developing a color theme I came across an issue related to semantic highlighting and the git diff side-by-side view of changes in a file.

I've tested a view of the languages that I use and from what I can tell it is more extreme for C# and C++ (might be others). [screenshots provided]

However, all the languages I looked at did not use the Semantic Highlighting colors of the theme inside the git diff. This was also tested using the default VSCode theme.

VS Code version: Code - Insiders 1.58.0-insider (7dea6d7402b55671410a129661cad24b55aed9f4, 2021-06-18T13:58:43.903Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No

System Info |Item|Value| ![061821-110527PM_Code_-_Insiders_R40IChDLlu](https://user-images.githubusercontent.com/596184/122629544-cb03fd80-d08b-11eb-9e54-5d6ee7214457.png) ![061821-110547PM_Code_-_Insiders_RgC0Dy4HA2](https://user-images.githubusercontent.com/596184/122629553-cfc8b180-d08b-11eb-9c7c-b18162e3f61f.png) |---|---| |CPUs|Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz (12 x 3200)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.92GB (5.57GB free)| |Process Argv|--crash-reporter-id f609d5ad-2cad-4931-bef4-e4619e08c2b7| |Screen Reader|no| |VM|0%|
Extensions (149) Extension|Author (truncated)|Version ---|---|--- stack-overflow-view|4tr|0.1.1 android-dev-ext|ade|1.3.2 vscode-icalendar|af4|1.0.1 Bookmarks|ale|13.1.0 project-manager|ale|12.2.0 vscode-sqlite|ale|0.13.0 shaderlabvscodefree|aml|1.2.8 vscode-color|ans|0.4.5 code-gnu-global|aus|0.2.2 color-info|bie|0.6.0 markdown-checkbox|bie|0.1.3 insert-unicode|bru|0.12.2 ink|bru|1.3.1 vscode-codetags|cg-|0.1.0 node-snippets|chr|1.3.2 vscode-modelines|chr|2.0.5 path-intellisense|chr|2.3.0 vscode-css-modules|cli|0.2.3 codeswing|cod|0.0.16 codestream|Cod|11.0.10 bracket-pair-colorizer-2|Coe|0.2.1 doxdocgen|csc|1.3.2 vscode-svgviewer|css|2.0.0 vscode-autohotkey-plus|cwe|2.6.2 vscode-eslint|dba|2.1.23 vscode-new-file|dku|4.0.2 xml|Dot|2.5.1 vscode-surround-with|drc|1.2.0 dircolors|dun|1.1.1 vscode-go-syntax|dun|0.0.18 gitlens|eam|11.5.1 tsl-problem-matcher|eam|0.4.0 vscode-html-css|ecm|1.10.2 next-js-commands|edg|0.0.1 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.22 prettier-vscode|esb|6.4.0 vs-sharper|ese|0.2.0 vscode-todo-plus|fab|4.18.3 vscode-solution-explorer|fer|0.4.3 foam-vscode|foa|0.13.7 auto-close-tag|for|0.5.10 auto-rename-tag|for|0.1.6 code-runner|for|0.11.4 private-extension-manager|gar|1.6.0 private-extension-manager-remote-helper|gar|1.6.0 godot-tools|gee|1.1.2 vscode-pull-request-github|Git|0.27.1 mdmath|goe|2.7.4 todo-tree|Gru|0.0.213 vscode-guid|hea|1.4.20 github-repository-manager|hen|0.6.1 toggler|hid|0.2.0 beautify|Hoo|1.5.0 output-colorizer|IBM|0.1.2 iceworks-time-master|ice|1.0.1 mysql-syntax|jak|1.3.1 RelativePath|jak|1.4.0 search-node-modules|jas|1.3.0 csharpextensions|jch|1.3.1 markdown-extended|jeb|1.0.19 better-cpp-syntax|jef|1.15.6 vscode-nuget-package-manager|jmr|1.1.6 svg|joc|1.4.7 roslynator|jos|3.2.0 vscode-random|jre|1.9.0 docomment|k--|0.1.20 google-search|kam|0.0.1 auto-comment-blocks|kev|1.0.1 vscode-gutter-preview|kis|0.27.1 kite|kit|0.147.0 unity-code-snippets|kle|1.3.0 vscode-markdown-notes|kor|0.0.24 csharpfixformat|Leo|0.0.84 sln-support|log|0.0.1 rainbow-csv|mec|1.8.1 git-graph|mhu|1.30.0 dotenv|mik|1.0.1 compare-folders|mos|0.22.2 vscode-autoprefixer|mrm|3.0.1 vscode-less|mrm|0.6.3 language-gettext|mro|0.2.0 vscode-docker|ms-|1.13.0 csharp|ms-|1.23.12 python|ms-|2021.6.944021595 vscode-pylance|ms-|2021.6.2 jupyter|ms-|2021.7.949309867 remote-containers|ms-|0.183.0 remote-ssh|ms-|0.65.7 remote-ssh-edit|ms-|0.65.7 remote-wsl|ms-|0.58.1 vscode-remote-extensionpack|ms-|0.21.0 cpptools|ms-|1.4.1 cpptools-extension-pack|ms-|1.0.0 mono-debug|ms-|0.16.2 powershell|ms-|2021.5.1 typescript-javascript-grammar|ms-|0.0.55 vsliveshare|ms-|1.0.4419 vsliveshare-audio|ms-|0.1.91 vscode-paste-image|mus|1.0.4 html-meta-tags-hero|nad|1.0.0 color-highlight|nau|2.3.0 godot-csharp-vscode|nei|0.1.3 vscode-versionlens|pfl|1.0.9 vscode-css-peek|pra|4.2.0 nextjs-snippets|Pul|0.0.3 text-power-tools|qcz|1.27.0 seti-icons|qin|0.1.3 snippets-viewer|Ran|1.9.0 toggle|reb|0.0.2 fabric8-analytics|red|0.3.3 java|red|0.79.2 vscode-commons|red|0.0.6 vscode-xml|red|0.16.1 explorer-exclude-vscode-extension|Red|1.2.0 nextjs-vscode-snippets|ret|0.1.1 vscode-gradle|ric|3.6.1 vscode-sort-json|ric|1.20.0 command-variable|rio|1.19.0 LiveServer|rit|5.6.1 code-stats-vscode|riu|1.0.18 gi|rub|0.2.11 partial-diff|ryu|1.4.3 code-settings-sync|Sha|3.4.3 vscode-checkstyle|she|1.4.0 shader|sle|1.1.5 swdc-vscode|sof|2.5.16 vscode-news|ste|0.1.2 rewrap|stk|1.14.0 code-spell-checker|str|1.10.2 control-snippets|svi|1.9.1 bootstrap4-vscode|the|6.1.0 hlsltools|Tim|1.1.302 msbuild-project-tools|tin|0.3.15 unity-tools|Tob|1.2.12 shell-launcher|Tyr|0.4.1 code-capture|Unc|1.1.0 unity-debug|Uni|3.0.2 errorlens|use|3.2.7 vscode-autohotkey-vj|vin|3.0.1 vscodeintellicode|Vis|1.2.14 vscode-java-debug|vsc|0.34.0 vscode-java-dependency|vsc|0.18.4 vscode-java-pack|vsc|0.16.0 vscode-java-test|vsc|0.30.0 vscode-maven|vsc|0.31.0 gistfs|vsl|0.2.9 markdown-all-in-one|yzh|3.4.0 html-css-class-completion|Zig|1.20.0 (3 theme extensions excluded)
aeschli commented 3 years ago

It is up to the language service to provide the semantic tokens. In the case of a diff editor, the left hand side is a virtual document (e.g. URI git:/home/martin/workspaces/vscode-test/views/foo.html?%7B%22path%22%3A%22%2Fhome%2Fmartin%2Fworkspaces

Not all languages services deal with virtual documents. But e.g. the HTML language server does and I verified that it also shows semantic tokens in a diff editor.

Please file the issue against the the language extensions.

ecool commented 3 years ago

Alright, thanks for the info @aeschli. I'll do that.