diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 14:58:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 14:58:15 +0800 |
commit | 9bfdfee9ede310b1331ae694890fa8f473cbc39c (patch) | |
tree | 4e25d5e76ac899b8c0a1623af4f9848cd22c940e /src/method | |
parent | edde29d07854ab60588f2236674b087ea699760a (diff) | |
download | lua-language-server-9bfdfee9ede310b1331ae694890fa8f473cbc39c.zip |
文本拆分后保存
Diffstat (limited to 'src/method')
-rw-r--r-- | src/method/init.lua | 11 | ||||
-rw-r--r-- | src/method/initialize.lua | 17 | ||||
-rw-r--r-- | src/method/textDocument/didChange.lua | 3 | ||||
-rw-r--r-- | src/method/textDocument/didOpen.lua | 4 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/method/init.lua b/src/method/init.lua new file mode 100644 index 00000000..972c7e16 --- /dev/null +++ b/src/method/init.lua @@ -0,0 +1,11 @@ +local method = {} + +local function init(name) + method[name] = require('method.' .. name:gsub('/', '.')) +end + +init 'initialize' +init 'textDocument/didOpen' +init 'textDocument/didChange' + +return method diff --git a/src/method/initialize.lua b/src/method/initialize.lua new file mode 100644 index 00000000..31c628de --- /dev/null +++ b/src/method/initialize.lua @@ -0,0 +1,17 @@ +return function (lsp, data) + lsp._inited = true + + return { + capabilities = { + -- 支持“转到定义” + definitionProvider = true, + -- 文本同步方式 + textDocumentSync = { + -- 打开关闭文本时通知 + openClose = true, + -- 文本改变时增量通知 + change = 2, + } + } + } +end diff --git a/src/method/textDocument/didChange.lua b/src/method/textDocument/didChange.lua new file mode 100644 index 00000000..6cae5e07 --- /dev/null +++ b/src/method/textDocument/didChange.lua @@ -0,0 +1,3 @@ +return function (lsp, params) + return true +end diff --git a/src/method/textDocument/didOpen.lua b/src/method/textDocument/didOpen.lua new file mode 100644 index 00000000..79392a79 --- /dev/null +++ b/src/method/textDocument/didOpen.lua @@ -0,0 +1,4 @@ +return function (lsp, params) + lsp:saveText(params.url, params.version, arams.text) + return true +end |