summaryrefslogtreecommitdiff
path: root/src/method/textDocument/definition.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-11-19 17:48:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-11-19 17:48:40 +0800
commit3fd972facc6dfb859d71899309723243b7b93880 (patch)
treec8826db23766ded68326972683e14b80b4cd0ad1 /src/method/textDocument/definition.lua
parentc25e44113af96356dddf8098c375e2537ebb1b4d (diff)
downloadlua-language-server-3fd972facc6dfb859d71899309723243b7b93880.zip
减少无用日志
Diffstat (limited to 'src/method/textDocument/definition.lua')
-rw-r--r--src/method/textDocument/definition.lua6
1 files changed, 6 insertions, 0 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