Godot: GDscript keywords are automatically replaced by something irrelevant

Created on 30 Jul 2016  路  9Comments  路  Source: godotengine/godot

_This is a generalised version of the #5964_
After posting issue #5964 and seeing @rgrams 's comment, I decided to look a little bit more into the problem.

Operating system or device - Godot version:
Windows(does not matter), Godot 2.1RC1

Issue description (what happened, and what was expected):
Whenever you type a keyword(pass, true, ...) the editor suggests another unrelated function or constant. This problem is especially irritating if the keyword is followed by a newline because it automatically replaces the keyword in question.
I went through most GDscript key word and noted what happened
The results: https://docs.google.com/spreadsheets/d/1nfh7Pw-5Qts0CBBN3okk6Y8CDsofJLlC07oTZfL6Wxo/edit?usp=sharing
Turns out, the engine never suggests any keyword and sometimes replaces them with surprising results...

Link to minimal example project (optional but very welcome):
example with return :
ss

PS: this should be a quick fix, I hope it makes into RC2 or 2.1 stable :)

bug editor gdscript

Most helpful comment

A better way would be not selecting a completion automatically, so the user would have to explicitly select some entry before it accepts the completion.

Atom has something like this in its settings:

atom-autocomplete-settings

We could have something similar in the editor settings. The default is "tab and enter", but I prefer using just "tab".

All 9 comments

Yeah, it is annoying.
This is why I generally disable autocomplete.
The problem is that it is not possible to resolve this in
any sane way (except binding autocomplete to key
and never running it automatically).
For less intimidating behaviour, adding all keywords to autocomplete
dictionary might make it easier for users, also making autocomplete more intelligent
(like detecting complete identifier and not trying to autocomplete it)
would also help, too.

As I said in the other issue, this can easily be solved by adding keywords to the auto-completion list.

A better way would be not selecting a completion automatically, so the user would have to explicitly select some entry before it accepts the completion.

@vnen The completion is not selected automatically. The problem is that the user is pressing RETURN to add a new line.
As you said, we should add script keywords to the auto-completion list in order to fix this.

A better way would be not selecting a completion automatically, so the user would have to explicitly select some entry before it accepts the completion.

Atom has something like this in its settings:

atom-autocomplete-settings

We could have something similar in the editor settings. The default is "tab and enter", but I prefer using just "tab".

double pressing tab key in linux terminal auto completes known directory paths. This behaviour can be used as well.

Although @Calinou's proposal is good, I would not forget to add auto-completion for keywords, which solves this issue.

I would just add some details that I found out.

In the 2.0.x versions the autocompletion was matching the case and the exact expression
2 0 3
In 2.1 (stable official) it doesn't.
2 1
This is useful when you accidentally press the CapsLock key or when you miss out a letter when typing.
However, it would be better if the autocompletion put the exact expression and case first, and only after the suggestions.

Also, the order is weird. It is not alphabetical, and it doesn't follow the declaration order. Here is an example in 2.1 (stable official), for the EditorPlugin:
order

This is still an issue in 2.1.1 stable. Just typing return true at the end of a function requires paying attention as that last true plus ENTER key which you'd naturally press to go to a new line at the end of the function will turn your line into return HTTPRequest

I've had Godot complaining about compile/runtime errors due to this type of autocompletion error multiple times in the last hour.

Adding all godot keywords to the autocompletion/intellisense list would fix this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  161Comments

reduz picture reduz  路  111Comments

zatherz picture zatherz  路  121Comments

akien-mga picture akien-mga  路  366Comments

nunodonato picture nunodonato  路  143Comments