summaryrefslogtreecommitdiff
path: root/src/method/textDocument
diff options
context:
space:
mode:
Diffstat (limited to 'src/method/textDocument')
-rw-r--r--src/method/textDocument/definition.lua6
-rw-r--r--src/method/textDocument/didChange.lua1
-rw-r--r--src/method/textDocument/didClose.lua1
-rw-r--r--src/method/textDocument/didOpen.lua1
4 files changed, 6 insertions, 3 deletions
diff --git a/src/method/textDocument/definition.lua b/src/method/textDocument/definition.lua
index 9601cc4a..9fcd7f18 100644
--- a/src/method/textDocument/definition.lua
+++ b/src/method/textDocument/definition.lua
@@ -7,6 +7,7 @@ return function (lsp, params)
if not text then
return nil, '找不到文件:' .. uri
end
+ local start_clock = os.clock()
-- lua是从1开始的,因此都要+1
local pos = parser.calcline.position_utf8(text, params.position.line + 1, params.position.character + 1)
local suc, start, finish = matcher.definition(text, pos)
@@ -30,5 +31,10 @@ return function (lsp, params)
},
},
}
+ local passed_clock = os.clock() - start_clock
+ if passed_clock >= 0.01 then
+ log.warn(('[转到定义]耗时[%.3f]秒,文件大小[%s]字节'):format(passed_clock, #text))
+ end
+
return response
end
diff --git a/src/method/textDocument/didChange.lua b/src/method/textDocument/didChange.lua
index 09c62a6f..6856b729 100644
--- a/src/method/textDocument/didChange.lua
+++ b/src/method/textDocument/didChange.lua
@@ -1,7 +1,6 @@
return function (lsp, params)
local doc = params.textDocument
local change = params.contentChanges
- log.debug('更新文件:', doc.uri)
-- TODO 支持差量更新
lsp:saveText(doc.uri, doc.version, change[1].text)
return true
diff --git a/src/method/textDocument/didClose.lua b/src/method/textDocument/didClose.lua
index 3dcbd7d7..d4edb624 100644
--- a/src/method/textDocument/didClose.lua
+++ b/src/method/textDocument/didClose.lua
@@ -1,6 +1,5 @@
return function (lsp, params)
local doc = params.textDocument
- log.debug('关闭文件:', doc.uri)
lsp:removeText(doc.uri, doc.version)
return true
end
diff --git a/src/method/textDocument/didOpen.lua b/src/method/textDocument/didOpen.lua
index 8be4fa89..27fdda71 100644
--- a/src/method/textDocument/didOpen.lua
+++ b/src/method/textDocument/didOpen.lua
@@ -1,6 +1,5 @@
return function (lsp, params)
local doc = params.textDocument
- log.debug('打开文件:', doc.uri)
lsp:saveText(doc.uri, doc.version, doc.text)
return true
end