lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

"Save as" can cause "duplicate defined alias"

Open eigenbom opened this issue 1 year ago • 0 comments

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.

image

Reproduction steps

  1. Start with a new window, no workspace, etc
  2. Create a new file, e.g., "test.lua"
  3. Add some code and save the file ( --@alias id integer\n )
  4. "Save as" test_2.lua
  5. (Optional) You may need to repeatedly "Save as" (e.g., test_3.lua) to trigger the bug, I couldn't 100% repro
  6. 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

eigenbom avatar Jul 07 '24 00:07 eigenbom