starlark-lsp icon indicating copy to clipboard operation
starlark-lsp copied to clipboard

Hover support for custom symbols (variables, constants, functions)

Open vexvec opened this issue 3 years ago • 2 comments

Hover Support for custom symbols would be great, e.g. in the following snippet I would like to hover main and say_hello and get the docstring and function definution, like for builtin symbols.

"""
say something
"""
def say_hello(what):
    print("hello", what)

"""
main func
"""
def main():
    say_hello("name")

main()

vexvec avatar Sep 07 '22 13:09 vexvec

I think this works already -- in Python, and consequently, Starlark, the docstrings go after the declared thing. Try again with

def say_hello(what):
    """
    say something
    """
    print("hello", what)

def main():
    """
    main func
    """
    say_hello("name")

nicksieger avatar Sep 07 '22 13:09 nicksieger

@nicksieger you're right concerning the docstring. Obviously I'm too much in Go and Typescript :-). So the only improvement here were if the symbol definition could also be provided in the hover.

vexvec avatar Sep 07 '22 13:09 vexvec