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/315ca4dc-ef29-4cf9-bf88-8e4e152e6f53n%40googlegroups.com.
