Align allowed-globals with the currently selected docs

This commit is contained in:
XeroOl 2024-05-17 20:45:37 -05:00
parent a122d9d361
commit 4c92af1bc5
3 changed files with 15 additions and 17 deletions

View File

@ -293,9 +293,7 @@ identifiers are declared / referenced in which places."
(call-me-to-reset-the-compiler) (call-me-to-reset-the-compiler)
(error "__NOT_AN_ERROR")))) (error "__NOT_AN_ERROR"))))
(local allowed-globals (local allowed-globals (docs.get-all-globals self))
(icollect [k _ (pairs _G)]
k))
(each [_ v (ipairs (utils.split-spaces self.configuration.extra-globals))] (each [_ v (ipairs (utils.split-spaces self.configuration.extra-globals))]
(table.insert allowed-globals v)) (table.insert allowed-globals v))

View File

@ -18,22 +18,21 @@
:lua53 (require :fennel-ls.docs.lua53) :lua53 (require :fennel-ls.docs.lua53)
:lua54 (require :fennel-ls.docs.lua54)}) :lua54 (require :fennel-ls.docs.lua54)})
(fn compute-global-docs [self] (fn get-lua-version [version]
(local sets []) (when (not (. versions version))
(when (not (. versions self.configuration.version)) (error (.. "fennel-ls doesn't know about lua version " version "\n"
(error (.. "fennel-ls doesn't know about lua version " self.configuration.version "\n" "The allowed versions are: "
"The allowed versions are:"
(fennel.view (icollect [key (pairs versions)] (fennel.view (icollect [key (pairs versions)]
key))))) key)))))
(table.insert sets (. versions self.configuration.version))) (. versions version))
(fn get-all-globals [self]
(icollect [name (pairs (get-lua-version self.configuration.version))]
name))
(fn get-global [self global-name] (fn get-global [self global-name]
(when (not (. versions self.configuration.version)) (. (get-lua-version self.configuration.version)
(error (.. "fennel-ls doesn't know about lua version " self.configuration.version "\n" global-name))
"The allowed versions are:"
(fennel.view (icollect [key (pairs versions)]
key)))))
(. versions self.configuration.version global-name))
(fn get-builtin [_self builtin-name] (fn get-builtin [_self builtin-name]
(or (. specials builtin-name) (or (. specials builtin-name)
@ -42,4 +41,5 @@
;; TODO get-module-metadata ;; TODO get-module-metadata
{: get-global {: get-global
: get-builtin} : get-builtin
: get-all-globals}

View File

@ -179,7 +179,7 @@
;; things that aren't present in lua5.4 but are in other versions, I guess?? ;; things that aren't present in lua5.4 but are in other versions, I guess??
(local things-that-are-allowed-to-have-missing-docs (local things-that-are-allowed-to-have-missing-docs
{:lua 1 :set-forcibly! 1 :unpack 1 :setfenv 1 :getfenv 1 :module 1 :newproxy 1 :gcinfo 1 :loadstring 1 :bit 1 :jit 1 :bit32 1}) {:lua 1 :set-forcibly! 1}) ;:unpack 1 :setfenv 1 :getfenv 1 :module 1 :newproxy 1 :gcinfo 1 :loadstring 1 :bit 1 :jit 1 :bit32 1})
(check "(" (check "("
[;; builtin specials [;; builtin specials