golang / vscode-go

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

Syntax highlighting for the editing tooltip #3129

Open Oxygels opened 6 months ago

Oxygels commented 6 months ago

Is your feature request related to a problem? Please describe. We have syntax highlighting for the "hover tooltip" such as image

However the "editing tooltip" hasn't the syntax highlighting unfortunately and that's the purpose of this request image

Describe the solution you'd like An identical behavior between the hover and the editing tooltip

Describe alternatives you've considered /

Additional context C# Dev Kit doesn't have this feature, and neither does the old python LSP. This is kinda "rare" for LSPs to have this enabled but it is a great QoL feature to have.

hyangah commented 6 months ago

Looks like our language server already provides markdown format of the documentation property.

The info like func(a ...any) (n int, err error) is supplied as detail property of completion item https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem or https://code.visualstudio.com/api/references/vscode-api#CompletionItem. Rendering of the information is done by the VS Code. Please open an issue to microsoft/vscode repo. Strictly speaking, from VS Code's point of view, detail isn't necessarily a code snippet.

Alternatively, I think gopls can try to embed the symbol info in the markdown documentation field as done for hover, and skip the detail field, but we need to be careful about unexpected side effects.