-
Notifications
You must be signed in to change notification settings - Fork 328
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
Cannot read property 'range' of null: CompletionItem.textEdit cannot be null #127
Comments
Looking more at the code, it seems like the |
Although all these properties are defined as optional they aren't really all optional :-). I (and Joh) were too lazy to define different type defining the legal combinations. What I will do is to change the code that if all properties are missing I will create a completion item which does nothing. |
Thanks for the explanation! Is there any reference which combination of properties are actually legal? |
Actually no. Will add to the list of things to do. What happens as a fallback is that the item does nothing when selected but such an item is not very useful :-) |
Could you give a rough description for the meantime? |
It should either have a { insertString } a { insertString, range } (new in 3.0) or a { textEdit } |
I fixed the code to create a noop completion item in case all properties except label are missing. |
Isn't |
@felixfbecker you are correct that the label is used. My code fix does result in this. Sorry for the incorrect comment. My change creates an empty CompletionItem. |
The protocol defines that all properties on
CompletionItem
exceptlabel
are optional. However, sending a completion item with only alabel
results in this exception:That is because here
textEdit
is passed toasTextEdit
, which passestextEdit.range
toasRange
.textEdit
can benull
though, which leads to the exception.The same happens with
asCommand
.I highly recommend you to take a look at
strictNullChecks
- it prevents these bugs at compile-time!The text was updated successfully, but these errors were encountered: