gophernotes icon indicating copy to clipboard operation
gophernotes copied to clipboard

Shift + Tab signature hinting?

Open ptiger10 opened this issue 6 years ago • 7 comments
trafficstars

Coming from a Python-in-Jupyter background, I notice that Tab works as you would expect (reveals all available methods/attributes), but Shift+Tab (signature hinting) does not. I could not find documentation on this. Is Shift+Tab not supported, or is my setup is incorrect?

Example:

type Foo struct {
    name string
    description string
}
func (f Foo) Qux(s string) string {
    return s
}
n := Foo{"bar", "baz"}
  • n. + Tab Works as expected -> shows dropdown list: name, description
  • n.Qux( + Tab Does not work as expected -> does not show anything and logs in Terminal: Unhandled shell message: inspect_request

My setup:

$ jupyter --version
4.4.0

$ uname -v
Darwin Kernel Version 17.7.0: Wed Apr 24 21:17:24 PDT 2019; root:xnu-4570.71.45~1/RELEASE_X86_64

$ brew list --versions zeromq
zeromq 4.3.1_1

ptiger10 avatar Jun 03 '19 17:06 ptiger10

Only Tab is currently implemented. What should be displayed by Shift + Tab ?

cosmos72 avatar Jun 03 '19 17:06 cosmos72

Ideally, the behavior would be the same as in Python, which is to create a hover element with the function signature and docstring. If you press Tab a second time (while still holding Shift), the hover element expands, and you can scroll within it. It makes a huge difference for API discoverability when using an analytics library.

Python Python

This is how Shift+Tab is currently rendered in the lgo notebook kernel. Go Go

ptiger10 avatar Jun 03 '19 20:06 ptiger10

Is there any other way to view documentation for a function?

bukowa avatar Apr 01 '21 19:04 bukowa

Sorry, there is currently no way to view the documentation for a function, because source code comments are not parsed / stored.

The function signature instead is available and could be shown by Shift+Tab - contributions are welcome!

cosmos72 avatar Apr 06 '21 13:04 cosmos72

As a workaround, to get the signature, I call the function without arguments:

image

It doesn't work with types, though.

orsinium avatar Apr 19 '21 07:04 orsinium

I'm also really interested in getting this working. This is an old project which (from the screenshots) looked to offer documentation for Go when you hit shift-tab.

Miles-Garnsey avatar Jun 02 '22 04:06 Miles-Garnsey

could we achieve this by integrating gopls (the language server)?

sudipidus avatar Jan 26 '24 08:01 sudipidus