LuaLS / LuaLS/lua-language-server
[Feature Request] Add Lua config file support
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
There are some Lua files that are used for configuration, such as .busted or *.rockspec files. It would be nice if:
- Any globals defined in them are ignored by default
- Global types and return types can be defined for them in a type definition file
This behavior could all be described by creating a type definition file with a special (config) option next to @meta. The require name is replaced by a Lua pattern that matches the filename or URI. Either that, or it could be specified as a config-specific option using ---@meta (config: PATTERN)
-- library/rockspec.d.lua
---@meta (config) "[%w%.%-%_]+%.rockspec$"
---the rockspec format
---@type string
_G.rockspec_format = nil
---the package name
---@type string
_G.package = nil
---the package version
---@type string
_G.version = nil
---a description of the rock
---@class luarocks.rockspec.description
---@field summary string? -- a short sentence that succinctly describes the rock
---@field description string? -- a paragraph-size description that describes the rock
---@field ...
_G.description = {}
For configurations that require returning a table, you could define a local variable with the right type and return it.
-- library/busted.d.lua
---@meta (config) "%.busted$"
---@class .busted.config
---@field coverage boolean? -- use luacov for coverage
---@field verbose boolean? -- print more things
---@field ...
---a dictionary of Busted configurations. You can specify which one using the
---`--run` option. Uses `default` if no configuration is specified
---@class .busted
---@field default .busted.config?
---@field [string] .busted.config?
local busted_config = {}
return busted_config
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 la sintassi @meta specifica della configurazione proposta e le definizioni di esempio in library/rockspec.d.lua e library/busted.d.lua. Confronta le alternative per la corrispondenza dei nomi dei file di configurazione o degli URI. Il lavoro è completato quando i file di configurazione Lua possono ignorare le variabili globali per impostazione predefinita e usare le definizioni dei tipi e dei valori restituiti dai file di definizione corrispondenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua
- Ambito
- devtools
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100