LuaLS / LuaLS/lua-language-server
Add documentation for the plugin environment
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
Plugins have a surprisingly large amount of flexibility when the surrounding environment is considered. Unfortunately, most of the environment is undocumented, which means there's a good chance plugin developers don't know how much their plugin can really do.
Currently, printing out package.path and package.cpath gives these directories
package.path
# directories provided by the extension
$LSP/script/?.lua
$LSP/script/?/init.lua
# access to the plugin's directory
$PLUGIN/?.lua
package.cpath
$LSP/bin/?.dll
where:
$LSPis the path to this project's folder, and$PLUGINis a path to the plugin's current directory.~/project/config/plugin.luawould make$PLUGINpoint to~/project/config
Along with giving plugins the ability to have sub-modules, the LSP has some very useful utilities in its script folder like:
vmfor inspecting types (or so it seems)parser.compilefor getting an ASTinspectwhich looks like kikito/inspect.luaconfigfor reading LSP settings likeLua.runtime.version
I don't work with Visual Studio enough to understand the DLLs in
$LSP/bin, or at least not enough to work with them in Lua.
... has some useful information too.
local inspect = require("inspect")
print(inspect({ ... }))
--[[-->
{
<function 1>, -- this plugin loaded as a chunk using `load()`
"file:///$WORKSPACE_FOLDER", -- a URI pointing to the workspace folder
{} -- arguments provided by the setting `Lua.runtime.pluginArgs`
}
]]
I think this information is useful enough to be documented in the wiki. I can contribute to it if need be.
It would be even more useful and accessible if there was a meta-addon that adds the $LSP/script directory to Lua.workspace.library or a boolean option that adds the directory internally. I can try to contribute to that as well.
I understand that $LSP/script may be updated often for bugfixes and other things. If this is the case, I think it would at least be useful to provide a directory for plugin utilities.
I'm not sure about what to do when the VS Code extension gets updated since it changes directory. Maybe, more generally, the LSP can warn you about missing libraries.
Also, if
$LSP/scriptupdates too frequently to be mentioned in the wiki, I think the meta-addon route would be more fruitful.
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
Inizia esaminando i dettagli dell’ambiente del plugin indicati nell’issue, inclusi package.path, package.cpath, le utilità di $LSP/script e gli argomenti del plugin passati tramite .... Conferma quale comportamento è sufficientemente stabile da poter essere documentato nella wiki, quindi rendi chiari l’ambiente e le utilità disponibili agli autori dei plugin senza fare affidamento su modifiche speculative a DLL o meta-addon.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100