LuaLS / LuaLS/lua-language-server
VS Code variable resolution in @source annotations/relativity of paths
Nessuno ha ancora preso questa issue.
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
Intuitively, I expected:
---@sourceannotations in meta files with relative paths to be resolved relative to the workspace- VS Code variables in the
@sourcepath to be resolved when resolving a path
Actual Behaviour
@sourcepaths are resolved relative to the meta file itself- VS Code variables in the path are not resolved
Reproduction steps
- Create
.vscode/luals/library/foo.d.luawith:---@meta --- @class foo _G.foo = {} ---@source grault/foo.lua:1 function bar() end - Create
baz.luawith:require("foo") local quux = foo.bar() - In extension settings, set:
{ "Lua.workspace.userThirdParty": ["${fileWorkspaceFolder}/LuaLS"] }
[!NOTE]
The variable ${fileWorkspaceFolder} resolves correctly and adds the meta file to the list of search paths
- Open
baz.luain VS Code editor - Right click
bar - Select
Go to Definition - Observe:
VS Code opens a non-existent source file tab to.vscode/luals/library/grault/foo.lua
Additional Notes
This could be two separate issues, but they're tightly related -- one as a Documentation Issue that the relativity of the resolution of the path should be added to the docs, and two as a Bug/Feature Request that VS Code variables be resolved in the @source paths as they are in the settings
Attempting to work around this using VS Code variables has the variable unresolved and taken literally. For example, setting the @source path to /${fileWorkspaceFolder}/grault/foo.lua:1 causes VS Code to open a tab to that literal string instead of the expected /home/me/my_project/grault/foo.lua:1
Log File
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci l’esempio con .vscode/luals/library/foo.d.lua, baz.lua e l’impostazione workspace.userThirdParty. Inizia tracciando come vengono risolti i percorsi @source e come vengono espanse le variabili di VS Code, quindi verifica il comportamento dei percorsi relativi e la sostituzione delle variabili rispetto alla destinazione Go to Definition prevista. Documenta la relatività del percorso scelta se rimane invariata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100