From 9bfdfee9ede310b1331ae694890fa8f473cbc39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 19 Nov 2018 14:58:15 +0800 Subject: =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=8B=86=E5=88=86=E5=90=8E=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/method/init.lua | 11 +++++++++++ src/method/initialize.lua | 17 +++++++++++++++++ src/method/textDocument/didChange.lua | 3 +++ src/method/textDocument/didOpen.lua | 4 ++++ 4 files changed, 35 insertions(+) create mode 100644 src/method/init.lua create mode 100644 src/method/initialize.lua create mode 100644 src/method/textDocument/didChange.lua create mode 100644 src/method/textDocument/didOpen.lua (limited to 'src/method') 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 -- cgit v1.2.3