lua-language-server
lua-language-server copied to clipboard
"Save as" can cause "duplicate defined alias"
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Annotations
Expected Behaviour
"Save as" should clear the cached aliases from the previous file (in the case of no workspace/folder)
Actual Behaviour
With a new window with no workspace, when I used "save as" I noticed the aliases from the file were still being used, causing a conflict duplicate defined alias with the newly named file. See repro steps.
Reproduction steps
- Start with a new window, no workspace, etc
- Create a new file, e.g., "test.lua"
- Add some code and save the file (
--@alias id integer\n) - "Save as" test_2.lua
- (Optional) You may need to repeatedly "Save as" (e.g., test_3.lua) to trigger the bug, I couldn't 100% repro
- Observe Duplicate defined alias
id
Reload editor to clear error
Additional Notes
This is an edge case, as typically you'd have an workspace or folder open (in which case 'save as' should keep the previous file cached also).
Log File
No response