diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 15:05:54 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 15:05:54 +0800 |
commit | 14f6d57ba711eb2d64470270ee7191181bfa25dc (patch) | |
tree | b804f09e00505e00d0afc107a17902882bd14d61 /src | |
parent | 9bfdfee9ede310b1331ae694890fa8f473cbc39c (diff) | |
download | lua-language-server-14f6d57ba711eb2d64470270ee7191181bfa25dc.zip |
先不支持差量更新
Diffstat (limited to 'src')
-rw-r--r-- | src/lsp.lua | 6 | ||||
-rw-r--r-- | src/method/initialize.lua | 4 | ||||
-rw-r--r-- | src/method/textDocument/didChange.lua | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/lsp.lua b/src/lsp.lua index 796e24b1..ab3ed3fe 100644 --- a/src/lsp.lua +++ b/src/lsp.lua @@ -106,11 +106,11 @@ function mt:saveText(url, version, text) return end obj.version = version - obj.lines = parser.split(text) + obj.text = text else lsp._file[url] = { version = version, - text = parser.split(text), + text = text, } end end @@ -120,7 +120,7 @@ function mt:loadText(url) if not obj then return nil end - return table.concat(obj.text, '\r\n') + return obj.text end function mt:start(method) diff --git a/src/method/initialize.lua b/src/method/initialize.lua index 31c628de..f16365c0 100644 --- a/src/method/initialize.lua +++ b/src/method/initialize.lua @@ -9,8 +9,8 @@ return function (lsp, data) textDocumentSync = { -- 打开关闭文本时通知 openClose = true, - -- 文本改变时增量通知 - change = 2, + -- 文本改变时完全通知 TODO 支持差量更新(2) + change = 1, } } } diff --git a/src/method/textDocument/didChange.lua b/src/method/textDocument/didChange.lua index 6cae5e07..f8fe4320 100644 --- a/src/method/textDocument/didChange.lua +++ b/src/method/textDocument/didChange.lua @@ -1,3 +1,5 @@ return function (lsp, params) + -- TODO 支持差量更新 + lsp:saveText(params.url, params.version, params.text) return true end |