Skip to content

GDscript LSP docstring and function signature problems #51617

@aMOPel

Description

Godot version

3.3.2.stable

System information

Ubuntu 20.04, Intel HD graphics, GLES3

Issue description

EDIT: Added 3.

  1. Docstrings aren't found by the language server, when all arguments are spread over multiple lines.
  2. Default parameters that are a variable, aren't displayed with a type in the returned documentation.
  3. The documentation returned for .new() calls, is the one from GDScript.new(). This is useless, instead it should be the documentation from the _init() in the instantiated class. Or how else are you supposed to know what parameters the constructor takes?

Steps to reproduce

I'm using neovim with lspconfig, but i don't think that has anything to do with the documentation returned by the godot language server.
1.

# test docstring
func test(a : int, b := [], c:= defaults) -> void:

works

func test(a: int, b: Array, c) -> null

test docstring
# test docstring
func test(a : int,
b := [],
c:= defaults
) -> void:

works

func test(a: int, b: Array, c) -> null

test docstring

BUT

# test docstring
func test(
a : int,
b := [],
c:= defaults
) -> void:

doesn't return the docstring any longer. This is especially unfortunate, because gdformat from the gdtoolkit (the only gdscript formater i found) formats long function definitions like this.

func test(a : int, b := [], c:= defaults) -> void:

gives func test(a: int, b: Array, c) -> null as documentation returned by the language server.
However defaults is a Dictionary with inferred type, so it should be possible to at least display the type. But displaying the default values as well would be really nice i think.

Node.new()

Hover gives me this:

	func GDScript.new(...) -> Variant

Returns a new instance of the script.

For example:



	var MyClass = load("myclass.gd")
	var instance = MyClass.new()
	assert(instance.get_script() == MyClass)



	func NativeScript.new(...) -> Variant

Constructs a new object of the base type with a script of this type already attached.

*Note*: Any arguments passed to this function will be ignored and not passed to the native constructor function. This will change with in a future API extension.


	func PluginScript.new(...) -> Variant

Returns a new instance of the script.

Function signature this:

func GDScript.new(...) -> Variant
────────────────────────────────────────────
	func GDScript.new(...) -> Variant

Returns a new instance of the script.

For example:



	var MyClass = load("myclass.gd")
	var instance = MyClass.new()
	assert(instance.get_script() == MyClass)

Thanks a lot for the great work <3

Minimal reproduction project

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions