-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Describe the bug
Hovering over a variable shows type information about the variable. However, if the source file has unsaved edits that moved the variable's declaration around, the help message is rendered incorrectly.
To Reproduce**
Write a module with this function in it and save it:
test(<<X:32>>) ->
X + 1.
Hovering over X
in the X = 1
expression displays the tooltip X :: number()
.
Now insert a space in the previous line before X
, but do not save the document:
test(<< X:32>>) ->
X + 1.
Hovering over X
in the X = 1
expression now gives the tooltip :: number()
.
Expected behavior
Unsaved edits that only move the declaration around shouldn't impact the help message.
Actual behavior
It looks like the variable's name is taken from the same position where it was declared in the saved file, even though it may now be moved around. E.g. adding some space before a variable with a long name will chop off characters from the end of its name, and deleting white space from before the variable will chop off characters from the beginning of its name.
Interestingly, renaming the variable would display the type help with the correct variable name, and no compilation errors are reported until the file is saved. For example with this unsaved edit:
test(<<Y:32>>) ->
X + 1.
Context
- ELP Version (output of
elp version
):elp 1.1.0+build-2024-04-29
- Editor used: VS Code