LuaLS / LuaLS/lua-language-server
Require paths not resolved when external library is loaded and using custom require path
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Windows
What is the issue affecting?
Completion, Hover, Libraries
Expected Behaviour
Hovering above lib should find lua/lib.lua.
Actual Behaviour
Hovering above lib yields 3 bytes, and only finds the path if either the file has not been loaded or no extra workspace library directory has been found.
Reproduction steps
- Setup the files:
-- lua/lib.lua
return {
test = "hello"
}
-- cmd/test.lua
local lib = require 'lib'
assert(lib.test == "hello")
-- .luarc.json
{
"runtime.path": [
"lua/?.lua",
"lua/?/init.lua"
],
"workspace.library": [
"${3rd}/love2d/library"
]
}
- Close NeoVim.
- Reopen NeoVim and open only the file
cmd/test.lua - Hover above lib and see bug.
- Open
lua/lib.lua - Go back to
cmd/test.lua - Completion is now available again.
Additional Notes
I could not reproduce this behaviour in VSCode.
Log File
Log file generated using the reproduction steps: https://pastebin.com/4VXMJjjB
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem mit .luarc.json unter Verwendung von lua/lib.lua und cmd/test.lua, indem du die aufgeführten NeoVim-Schritte befolgst und das verknüpfte Protokoll überprüfst. Verfolge, wie custom runtime.path und workspace.library behandelt werden, nachdem die externe Bibliothek geladen wurde; fertig ist es, wenn Hovering und Vervollständigung lib konsistent auflösen, ohne zuvor lua/lib.lua zu öffnen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100