summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lsp.lua6
-rw-r--r--src/method/initialize.lua4
-rw-r--r--src/method/textDocument/didChange.lua2
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