VS Code variable resolution in @source annotations/relativity of paths
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Reproduziere das Beispiel mit .vscode/luals/library/foo.d.lua, baz.lua und der workspace.userThirdParty-Einstellung. Beginne damit nachzuverfolgen, wie @source-Pfade aufgelöst werden und wie VS Code-Variablen erweitert werden, und überprüfe anschließend das Verhalten relativer Pfade und die Variablensubstitution anhand des erwarteten Go to Definition-Ziels. Dokumentiere die gewählte Pfadrelativität, falls sie unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- Ø Merge
- 8 T. 9 Std.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus LuaLS/lua-language-server
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
LuaLS/lua-language-server#1776 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
LuaLS/lua-language-server#3463 · 5 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
LuaLS/lua-language-server#3461 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3460 · 1 Kommentar · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3459 · 1 Reaktion ·
Alle Issues in LuaLS/lua-language-server
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
HenrikBengtsson/CBI-software#134 ·
-
Nmap
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
secondlife/slua#96 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100