golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.84k stars 735 forks source link

VS Code auto-corrected the spelling of an imported constant. #3087

Closed bnkamalesh closed 8 months ago

bnkamalesh commented 8 months ago

Please find the system and extension specifications below:

Type: Bug Ref

There's a constant named "Status_STATUS_CANCELLED" in one of the Golang protobuff generated file. And VSCode auto-corrects the spelling, to single L instead of LL, when importing the constant in code.

VS Code version: Code 1.85.0 (Universal) (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T18:18:04.614Z) OS version: Darwin x64 21.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-1068NG7 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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 3, 3| |Memory (System)|32.00GB (7.47GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (29) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 vscode-apollo|apo|1.20.0 unique-lines|bib|1.0.0 pgformatter|bra|1.28.1 language-prometheus|caa|0.1.2 gotemplate|cas|0.4.0 vscode-eslint|dba|2.4.2 gitlens|eam|2023.12.1204 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.1.0 go|gol|0.40.0 vscode-jsonnet|Gra|0.5.1 terraform|has|2.29.0 plantuml|jeb|2.17.5 vscode-docker|ms-|1.28.0 vscode-dotnet-runtime|ms-|2.0.0 vscode-kubernetes-tools|ms-|1.3.15 vscode-postgresql|ms-|0.3.0 isort|ms-|2023.10.1 python|ms-|2023.22.0 vscode-pylance|ms-|2023.11.10 makefile-tools|ms-|0.7.0 language-plantuml|qho|0.0.3 sqlite-viewer|qwt|0.3.13 vscode-xml|red|0.26.1 vscode-yaml|red|1.14.0 rust-analyzer|rus|0.3.1766 even-better-toml|tam|0.19.2 vscode-proto3|zxh|0.5.5
$ go version
go version go1.21.5 darwin/amd64

The issue occurs only when I have the Go extension enabled. User specific Go extension configuration

{
  "go.addTags": {
    "tags": "json",
    "options": "json=omitempty",
    "promptForTags": false,
    "transform": "snakecase"
  },
  "go.formatTool": "goimports",
  "go.alternateTools": {
    "go-langserver": "gopls"
  },
  "go.toolsManagement.autoUpdate": true,
  "go.lintTool": "golangci-lint",
  "[go]": {},
  "go.languageServerFlags": []
}
hyangah commented 8 months ago

@bnkamalesh Do you observe this issue if you disable golangci-lint? (delete the "go.lintTool" setting or set it to the extension's default).

bnkamalesh commented 8 months ago

@hyangah thanks for the support.

Nope the issue does not exist if I disable "go.lintTool": "golangci-lint",

hyangah commented 8 months ago

I don't recall such capability coming from gopls or staticcheck. If this extension thinks misspelling is an issue, it should first report the problem as diagnostics. But I may be missing something.

bnkamalesh commented 8 months ago

@hyangah like I mentioned, the issue is solved if I disable golangci-lint. I probably worded things confusing earlier 😓

hyangah commented 8 months ago

Sorry that I was in hurry and misread the response. Good to hear that the root cause was identified. Closing.