diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-02-21 14:27:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-02-21 14:27:56 +0800 |
commit | 61498917bb2d6686b97c6193b2f713f099faf769 (patch) | |
tree | 617c0780519ee065e8a2d74564e3cf97812a5d86 | |
parent | 2dd4ea4b7d95561b228a97800f5f68a30a6cff97 (diff) | |
download | lua-language-server-61498917bb2d6686b97c6193b2f713f099faf769.zip |
use `--preview` to enable preview features
-rw-r--r-- | .vscode/settings.json | 1 | ||||
-rw-r--r-- | script/config/config.lua | 2 | ||||
-rw-r--r-- | script/global.d.lua | 6 | ||||
-rw-r--r-- | script/provider/provider.lua | 5 |
4 files changed, 13 insertions, 1 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index f8ca82c5..0260f483 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ // Just some comment { "Lua.misc.parameters": [ + "--preview", "--develop=true", "--dbgport=11413", ] diff --git a/script/config/config.lua b/script/config/config.lua index e44b9372..ea87893d 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -208,7 +208,7 @@ local Template = { ['Lua.hint.arrayIndex'] = Type.Boolean >> 'Auto', ['Lua.window.statusBar'] = Type.Boolean >> true, ['Lua.window.progressBar'] = Type.Boolean >> true, - ['Lua.format.enable'] = Type.Boolean >> false, + ['Lua.format.enable'] = Type.Boolean >> true, ['Lua.IntelliSense.traceLocalSet'] = Type.Boolean >> false, ['Lua.IntelliSense.traceReturn'] = Type.Boolean >> false, ['Lua.IntelliSense.traceBeSetted'] = Type.Boolean >> false, diff --git a/script/global.d.lua b/script/global.d.lua index 0435293e..ad4fb364 100644 --- a/script/global.d.lua +++ b/script/global.d.lua @@ -33,3 +33,9 @@ FOOTPRINT = false ---trace rpc, use command line: --rpclog=true ---@type boolean RPCLOG = false + +--enable preview features. +-- +--the current version is `formatting` +---@type boolean +PREVIEW = false diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 0c1a95b4..f5bace80 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -61,6 +61,9 @@ m.attributes = {} function m.register(method) return function (attrs) m.attributes[method] = attrs + if attrs.preview and not PREVIEW then + return + end if attrs.capability then cap.filling(attrs.capability) end @@ -999,6 +1002,7 @@ m.register 'textDocument/formatting' { capability = { documentFormattingProvider = true, }, + preview = true, ---@async function(params) local uri = files.getRealUri(params.textDocument.uri) @@ -1036,6 +1040,7 @@ m.register 'textDocument/rangeFormatting' { capability = { documentRangeFormattingProvider = true, }, + preview = true, ---@async function(params) local uri = files.getRealUri(params.textDocument.uri) |