microsoft / vscode

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

Go syntax highlighting broken by some strings containing and surrounded by parenthesis #206130

Closed mgabeler-lee-6rs closed 8 months ago

mgabeler-lee-6rs commented 8 months ago

Type: Bug

Create a .go file:

package whatever
const x = (`()(.)`)
func foo() {
}

Observe that the string in the parenthesis is not highlighted correctly, and all following code is thought to be inside a string.

Note that this does not require having the Go extension enabled.

Some more observations:

This is my attempt at a minimal reproducer. The real world case I observed this is here: https://github.com/elastic/go-elasticsearch/blob/ab9e8b523888d41d85d475e5440c8634ccf84be7/elasticsearch.go#L62 image

VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:41:37.860Z) OS version: Linux x64 6.5.0-18-generic Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz (8 x 4499)| |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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|3, 3, 3| |Memory (System)|31.18GB (18.39GB free)| |Process Argv|--unity-launch --crash-reporter-id f628f52a-51ea-40c8-aedd-0af9d4a6bd9f| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu-xorg| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu-xorg| |XDG_SESSION_TYPE|x11|
Extensions (27) Extension|Author (truncated)|Version ---|---|--- github-markdown-preview|bie|0.3.0 markdown-checkbox|bie|0.4.0 markdown-emoji|bie|0.3.0 markdown-footnotes|bie|0.1.1 markdown-mermaid|bie|1.22.0 markdown-preview-github-styles|bie|2.0.3 markdown-yaml-preamble|bie|0.1.0 circleci|Cir|2.6.3 vscode-markdownlint|Dav|0.54.0 vscode-eslint|dba|2.4.4 EditorConfig|Edi|0.16.4 vscode-typescript-exportallmodules|eli|2.7.0 prettier-vscode|esb|10.1.0 copilot|Git|1.165.0 copilot-chat|Git|0.12.2 go|gol|0.41.1 vscode-peacock|joh|4.2.2 bash-ide-vscode|mad|1.39.0 remote-ssh|ms-|0.108.0 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.1 uuid-generator|net|0.0.5 vscode-commons|red|0.0.6 vscode-yaml|red|1.14.0 rewrap|stk|1.16.3 code-spell-checker|str|3.0.1 errorlens|use|3.16.0 (2 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 pydisww1:30959800 d34g3935:30971562 edj9j583:30969295 7j2b6412:30969109 e3gdj431:30958358 ccp1r6:30958156 ```
gjsjohnmurray commented 8 months ago

/duplicate of #206122

vscodenpa commented 8 months ago

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

Happy Coding!