Hi Qingwei Li,

You need to talk to the Microsoft
Visual Studio Code folks. Nobody minds helping
beginners to understand such easy to make mistakes, 
but it seems a tragedy not to get you to the right place,
or to leave you with the impression that continuing
this thread will produce any progress towards your goal.

In short, this is forum of Go Users, not Visual Studio Code 
developers. If you actually want a better VSCode 
experience you need to post an issue to 
https://github.com/microsoft/vscode/issues
or even better, implement the feature and
submit a pull request. VSCode is open source and
under an MIT license. You'll want to review 
https://github.com/microsoft/vscode/blob/main/CONTRIBUTING.md
if you wish to get your feature upstreamed.

Kind regards,
Jason

On Wednesday, November 5, 2025 at 9:29:11 AM UTC Qingwei Li wrote:

Thanks for your detailed explanation. I'm using vscode-go. So the better 
title of the conversation would be "vscode-go idea: ...". Sorry for wrong 
reference to gopls.

Besides, it seems that I can't modify the title of the conversation.
On Wednesday, November 5, 2025 at 12:29:15 PM UTC+8 Jason E. Aten wrote:

Hi Qingwei Li,

The gopls server can already answer such queries. However it is up to your 
editor 
(the client of the language server) to make the query in the first place. 

It may help to review https://en.wikipedia.org/wiki/Language_Server_Protocol
or https://microsoft.github.io/language-server-protocol/ to understand
the role of the client and the role of the server.

You probably need to add a new gopls query to your editor, or 
ask its authors for such a feature if it is not open source.

Kind regards,
Jason


~/go/pkg/mod/github.com/glycerine/[email protected] 
<http://github.com/glycerine/[email protected]> $ gopls definition 
walk.go:154:31 

~/go/pkg/mod/github.com/glycerine/[email protected]/walk.go:37:6-14 
<http://github.com/glycerine/[email protected]/walk.go:37:6-14>: defined 
here as type WalkFunc func(path string, info os.FileInfo, hasSubDir bool, 
err error) error 

WalkFunc is the type of the function called for each file or directory
visited by Walk. The path argument contains the argument to Walk as a
prefix; that is, if Walk is called with "dir", which is a directory
containing the file "a", the walk function will be called with argument
"dir/a". The info argument is the os.FileInfo for the named path. 

If there was a problem walking to the file or directory named by path, the 
incoming error will describe the problem and the function can decide how 
to handle that error (and Walk will not descend into that directory). If 
an error is returned, processing stops. The sole exception is that if path 
is a directory and the function returns the special value SkipDir, the 
contents of the directory are skipped and processing continues as usual on 
the next file.
$ 
On Tuesday, November 4, 2025 at 1:06:54 PM UTC Qingwei Li wrote:

Hello. I'm here to propose an idea for gopls. The idea is that when we 
hover over `func` token of a function literal whose type is documented, the 
documentation of the type can be shown.

The motivating example is as follows:

filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error {
    ...
}

When I am coding filepath.WalkDir, whose signature is `func 
filepath.WalkDir(root string, fn fs.WalkDirFunc) error`, I don't know 
what's the meaning of the third parameter `err` of `fs.WalkDirFunc`. I have 
to go to the browser to see documentation or ask LLM.

If we can decide the type of function literal is `fs.WalkDirFunc` and if 
`fs.WalkDirFunc` is documented, can we show documentation when hovering 
over `func` token? This is a similar behavior like hovering over function 
name of a call statement I think.


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/cd49a189-cc62-42a3-8f10-37562b312738n%40googlegroups.com.

Reply via email to