golang / vscode-go

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

`func` snippet prefix conflict with `func` keyword #3144

Open setanarut opened 5 months ago

setanarut commented 5 months ago

Vscode always selects the func keyword first. This is because the func snippet and the func keyword are the same. "editor.snippetSuggestions":"top", even if selected.

https://github.com/golang/vscode-go/blob/5557e746a5565b0c44f0f44fcf0f6b08dff0683b/extension/snippets/go.json#L44

To fix change func to fu.

"prefix": "fu", 

Before:

Ekran Resmi 2024-01-20 16 01 28

After:

Ekran Resmi 2024-01-20 16 03 36

I made a pull request but it was rejected. Because of the Contributor License Agreement (CLA). I can't waste my time on this.

hyangah commented 5 months ago

Thanks for filing the issue. We are considering to remove or shorten the list of snippets this extension supplies using this go.json snippet file. https://github.com/golang/vscode-go/issues/160

Can you use the user snippet? https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets