diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 17:48:40 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-19 17:48:40 +0800 |
commit | 3fd972facc6dfb859d71899309723243b7b93880 (patch) | |
tree | c8826db23766ded68326972683e14b80b4cd0ad1 /src | |
parent | c25e44113af96356dddf8098c375e2537ebb1b4d (diff) | |
download | lua-language-server-3fd972facc6dfb859d71899309723243b7b93880.zip |
减少无用日志
Diffstat (limited to 'src')
-rw-r--r-- | src/lsp.lua | 3 | ||||
-rw-r--r-- | src/method/textDocument/definition.lua | 6 | ||||
-rw-r--r-- | src/method/textDocument/didChange.lua | 1 | ||||
-rw-r--r-- | src/method/textDocument/didClose.lua | 1 | ||||
-rw-r--r-- | src/method/textDocument/didOpen.lua | 1 |
5 files changed, 6 insertions, 6 deletions
diff --git a/src/lsp.lua b/src/lsp.lua index 563f7919..eeb4e560 100644 --- a/src/lsp.lua +++ b/src/lsp.lua @@ -59,10 +59,7 @@ function mt:_readAsContent(header) local id = res.id local method = res.method local params = res.params - log.debug(('执行任务[%s],ID[%s]'):format(method, id)) - local clock = os.clock() local response, err = self:_callback(method, params) - log.debug(('任务[%s]执行完毕,耗时[%.3f]秒,ID[%s]'):format(method, os.clock() - clock, id)) if response then self:_send { id = id, 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 |