diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-05 17:59:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-05 17:59:36 +0800 |
commit | a8fd968dd81edb45d13f527cebd405d5abbbfd80 (patch) | |
tree | b5773c58e4835dbf5c0f7c95b4c9b9e3046117e8 | |
parent | 663a54fd01e069626e7e41bdab0223f01980711f (diff) | |
download | lua-language-server-a8fd968dd81edb45d13f527cebd405d5abbbfd80.zip |
把耗时统计挪走
-rw-r--r-- | server/src/method/textDocument/definition.lua | 5 | ||||
-rw-r--r-- | server/src/method/textDocument/implementation.lua | 5 | ||||
-rw-r--r-- | server/src/method/textDocument/references.lua | 5 | ||||
-rw-r--r-- | server/src/method/textDocument/rename.lua | 5 | ||||
-rw-r--r-- | server/src/service.lua | 5 |
5 files changed, 5 insertions, 20 deletions
diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index 90c964f3..a0a25f46 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -2,7 +2,6 @@ local parser = require 'parser' local matcher = require 'matcher' return function (lsp, params) - local start_clock = os.clock() local uri = params.textDocument.uri local results, lines = lsp:loadText(uri) if not results then @@ -37,10 +36,6 @@ return function (lsp, params) end local response = locations - local passed_clock = os.clock() - start_clock - if passed_clock >= 0.01 then - log.warn(('[Goto Definition] takes [%.3f] sec, size [%s] bits.'):format(passed_clock, #lines.buf)) - end return response end diff --git a/server/src/method/textDocument/implementation.lua b/server/src/method/textDocument/implementation.lua index 5ae22c6b..c0a37830 100644 --- a/server/src/method/textDocument/implementation.lua +++ b/server/src/method/textDocument/implementation.lua @@ -2,7 +2,6 @@ local parser = require 'parser' local matcher = require 'matcher' return function (lsp, params) - local start_clock = os.clock() local uri = params.textDocument.uri local results, lines = lsp:loadText(uri) if not results then @@ -37,10 +36,6 @@ return function (lsp, params) end local response = locations - local passed_clock = os.clock() - start_clock - if passed_clock >= 0.01 then - log.warn(('[Goto Implementation] takes [%.3f] sec, size [%s] bits.'):format(passed_clock, #lines.buf)) - end return response end diff --git a/server/src/method/textDocument/references.lua b/server/src/method/textDocument/references.lua index 22504d34..b816e732 100644 --- a/server/src/method/textDocument/references.lua +++ b/server/src/method/textDocument/references.lua @@ -2,7 +2,6 @@ local parser = require 'parser' local matcher = require 'matcher' return function (lsp, params) - local start_clock = os.clock() local uri = params.textDocument.uri local declarat = params.context.includeDeclaration local results, lines = lsp:loadText(uri) @@ -38,10 +37,6 @@ return function (lsp, params) end local response = locations - local passed_clock = os.clock() - start_clock - if passed_clock >= 0.01 then - log.warn(('[Find References] takes [%.3f] sec, size [%s] bits.'):format(passed_clock, #lines.buf)) - end return response end diff --git a/server/src/method/textDocument/rename.lua b/server/src/method/textDocument/rename.lua index d152b5cd..ac1e8fc6 100644 --- a/server/src/method/textDocument/rename.lua +++ b/server/src/method/textDocument/rename.lua @@ -2,7 +2,6 @@ local parser = require 'parser' local matcher = require 'matcher' return function (lsp, params) - local start_clock = os.clock() local uri = params.textDocument.uri local newName = params.newName local results, lines = lsp:loadText(uri) @@ -42,10 +41,6 @@ return function (lsp, params) [uri] = TextEdit, }, } - local passed_clock = os.clock() - start_clock - if passed_clock >= 0.01 then - log.warn(('[Find References] takes [%.3f] sec, size [%s] bits.'):format(passed_clock, #lines.buf)) - end return response end diff --git a/server/src/service.lua b/server/src/service.lua index faec738a..ae1d8c9d 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -33,7 +33,12 @@ function mt:_callMethod(name, params) end local f = method[name] if f then + local clock = os.clock() local suc, res, res2 = pcall(f, self, params) + local passed = os.clock() - clock + if passed > 0.01 then + log.debug(('Task [%s] takes [%.3f] sec.'):format(name, passed)) + end if suc then return res, res2 else |