diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-07 15:38:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-07 15:38:18 +0800 |
commit | f5464ddc9a8e043977f27e70d9f1dfc2be56b02e (patch) | |
tree | b2c3d0e061753e69105997a81c6e8567998054cf /script | |
parent | 0b87804cba3f24318362993ca2e32e0f95ce990d (diff) | |
download | lua-language-server-f5464ddc9a8e043977f27e70d9f1dfc2be56b02e.zip |
`boolean` kick `true` and `false`
Diffstat (limited to 'script')
-rw-r--r-- | script/client.lua | 2 | ||||
-rw-r--r-- | script/library.lua | 6 | ||||
-rw-r--r-- | script/vm/infer.lua | 15 |
3 files changed, 11 insertions, 12 deletions
diff --git a/script/client.lua b/script/client.lua index aa24ae24..7432e60b 100644 --- a/script/client.lua +++ b/script/client.lua @@ -256,7 +256,7 @@ local function tryModifyRC(uri, finalChanges, create) if not path then return false end - path = fs.exists(path) and path or workspace.getAbsolutePath(uri, '.luarc.json') + path = fs.exists(fs.path(path)) and path or workspace.getAbsolutePath(uri, '.luarc.json') if not path then return false end diff --git a/script/library.lua b/script/library.lua index d0294650..d2d45af1 100644 --- a/script/library.lua +++ b/script/library.lua @@ -209,7 +209,7 @@ local function initBuiltIn(uri) local langID = lang.id local version = config.get(uri, 'Lua.runtime.version') local encoding = config.get(uri, 'Lua.runtime.fileEncoding') - ---@type fspath + ---@type fs.path local metaPath = fs.path(METAPATH) / config.get(uri, 'Lua.runtime.meta'):gsub('%$%{(.-)%}', { version = version, language = langID, @@ -244,7 +244,7 @@ local function initBuiltIn(uri) goto CONTINUE end libName = libName .. '.lua' - ---@type fspath + ---@type fs.path local libPath = templateDir / libName local metaDoc = compileSingleMetaDoc(uri, fsu.loadFile(libPath), metaLang, status) if metaDoc then @@ -262,7 +262,7 @@ local function initBuiltIn(uri) end end ----@param libraryDir fspath +---@param libraryDir fs.path local function loadSingle3rdConfig(libraryDir) local configText = fsu.loadFile(libraryDir / 'config.lua') if not configText then diff --git a/script/vm/infer.lua b/script/vm/infer.lua index b1b7183e..94538a79 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -11,7 +11,6 @@ local vm = require 'vm.vm' ---@field _drop table local mt = {} mt.__index = mt -mt._hasNumber = false mt._hasTable = false mt._hasClass = false mt._hasFunctionDef = false @@ -45,7 +44,6 @@ local viewNodeSwitch = util.switch() end) : case 'number' : call(function (source, infer) - infer._hasNumber = true return source.type end) : case 'table' @@ -81,9 +79,6 @@ local viewNodeSwitch = util.switch() if not guide.isBasicType(source.name) then infer._hasClass = true end - if source.name == 'number' then - infer._hasNumber = true - end return source.name end end) @@ -252,9 +247,6 @@ function vm.getInfer(source) end function mt:_trim() - if self._hasNumber then - self.views['integer'] = nil - end if self._hasDocFunction then if self._hasFunctionDef then for view in pairs(self.views) do @@ -269,6 +261,13 @@ function mt:_trim() if self._hasTable and not self._hasClass then self.views['table'] = true end + if self.views['number'] then + self.views['integer'] = nil + end + if self.views['boolean'] then + self.views['true'] = nil + self.views['false'] = nil + end end ---@param uri uri |