diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-07-30 17:46:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-07-30 17:46:00 +0800 |
commit | aae2c7888bad227b6df897b97c01f123744175de (patch) | |
tree | a1947eaa8a9a1e4d1d95d4e2bb68337efe4b9390 | |
parent | e760b69c8104d0bf6ef17f6f033265908557743d (diff) | |
download | lua-language-server-aae2c7888bad227b6df897b97c01f123744175de.zip |
过测试
-rw-r--r-- | script/lclient.lua | 28 | ||||
-rw-r--r-- | script/vm/def.lua | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/script/lclient.lua b/script/lclient.lua index 13b431b0..96a6c16f 100644 --- a/script/lclient.lua +++ b/script/lclient.lua @@ -5,6 +5,8 @@ local await = require 'await' local timer = require 'timer' local pub = require 'pub' local json = require 'json' +local client = require 'client' +local define = require 'proto.define' require 'provider' @@ -61,9 +63,33 @@ function mt:_localLoadFile() end) end +local defaultClientOptions = { + initializationOptions = { + changeConfiguration = true, + viewDocument = true, + trustByClient = true, + useSemanticByRange = true, + }, + capabilities = { + textDocument = { + completion = { + completionItem = { + tagSupport = { + valueSet = { + define.DiagnosticTag.Unnecessary, + define.DiagnosticTag.Deprecated, + }, + }, + }, + }, + }, + }, +} + ---@async function mt:initialize(params) - self:awaitRequest('initialize', params or {}) + local initParams = util.tableMerge(params or {}, defaultClientOptions) + self:awaitRequest('initialize', initParams) self:notify('initialized') end diff --git a/script/vm/def.lua b/script/vm/def.lua index 669d39c2..ffd2de7a 100644 --- a/script/vm/def.lua +++ b/script/vm/def.lua @@ -93,7 +93,7 @@ function vm.getDefs(source) return results end -local HAS_DEF_ERR = {} -- the error object for comparing +local HAS_DEF_ERR = {'<HAS_DEF_ERR>'} -- the error object for comparing local function checkHasDef(checkFunc, source, pushResult) local _, err = pcall(checkFunc, source, pushResult) return err == HAS_DEF_ERR |