gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.8k stars 264 forks source link

Shift + Tab signature hinting? #173

Open ptiger10 opened 5 years ago

ptiger10 commented 5 years ago

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"}

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
cosmos72 commented 5 years ago

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

ptiger10 commented 5 years ago

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
bukowa commented 3 years ago

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

cosmos72 commented 3 years ago

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!

orsinium commented 3 years ago

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

image

It doesn't work with types, though.

Miles-Garnsey commented 2 years ago

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.

sudipidus commented 6 months ago

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