Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new built in function adds parentheses #189

Closed
TheColorRed opened this issue Jun 3, 2020 · 10 comments
Closed

Create new built in function adds parentheses #189

TheColorRed opened this issue Jun 3, 2020 · 10 comments
Labels
bug language server Issue is not originating from this extension, but from the LSP instead

Comments

@TheColorRed
Copy link

When creating a function such as _ready, _process, etc., opening and closing parentheses is created after the colon:

ExtraParen

@Calinou Calinou added the bug label Jun 4, 2020
@Calinou
Copy link
Member

Calinou commented Jun 4, 2020

Related to #184.

Which other VS Code extensions do you have enabled? Maybe one of them could interfere with autocompletion. (I haven't tested this locally.)

@TheColorRed
Copy link
Author

There shouldn't be any that interfere, these are the only ones I have enabled:

image

@TheColorRed
Copy link
Author

TheColorRed commented Jun 4, 2020

After testing more out, they each seem to work differently.

func _get_configuration_warning() -> String:
func _draw() -> void:()
func _process(delta: float) -> void:(
func _unhandled_input(event: InputEvent) -> void:(
  • Some are correct
  • Some have parentheses
  • Some don't have parentheses
  • Some have an opening parentheses

@Calinou
Copy link
Member

Calinou commented Jun 4, 2020

I think _get() doesn't have a return type because it can return anything. GDScript doesn't have an any return type yet (and doesn't allow to use Variant as a return type), so it has to be ommitted for now.

@TheColorRed
Copy link
Author

Okay, I have removed that from the list of tested items.

@Razoric480
Copy link
Contributor

Razoric480 commented Jun 5, 2020

func _get_configuration_warning() -> String:() adds parenthesis at the end for me, so it's also not correct. Though the other 3 are as stated.

@Razoric480
Copy link
Contributor

Razoric480 commented Nov 6, 2020

I've finally investigated this eons later and can confirm that it's an issue with the LSP.

if ((item.kind == lsp::CompletionItemKind::Method || item.kind == lsp::CompletionItemKind::Function) && !item.label.ends_with("):")) {
		item.insertText = item.label + "(";
		if (symbol && symbol->children.empty()) {
			item.insertText += ")";
		}
	}

does not take into consideration instances where static typing is included with ->.

@Calinou Calinou added the language server Issue is not originating from this extension, but from the LSP instead label Nov 6, 2020
@Misignu
Copy link

Misignu commented May 26, 2021

No any possible fix? This bug is a bit annoying.

@Calinou
Copy link
Member

Calinou commented May 27, 2021

@Misignu This is a bug that needs to be fixed in Godot's C++ code, not in the Visual Studio Code extension. Due to this, it will have to wait until someone opens a pull request to fix this on godotengine/godot and gets it merged.

@TheColorRed
Copy link
Author

This seems to have been resolved. I am not seeing the issue anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language server Issue is not originating from this extension, but from the LSP instead
Projects
None yet
Development

No branches or pull requests

5 participants