diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 09:02:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 09:02:51 +0800 |
commit | abd2a22ef2fc4197aab1cdf0ccae386b55db3dcc (patch) | |
tree | bda13bda0ff7055dad993076279ee05cc41b14a1 /server/src | |
parent | 262def33acf15a611ccd1ae777e33b7a07d7977a (diff) | |
download | lua-language-server-abd2a22ef2fc4197aab1cdf0ccae386b55db3dcc.zip |
应该判断时间
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/lsp.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/src/lsp.lua b/server/src/lsp.lua index 0784ae04..b94e4fbb 100644 --- a/server/src/lsp.lua +++ b/server/src/lsp.lua @@ -211,12 +211,11 @@ function mt:runStep() if suc then -- 协议内容读取成功后重置 self._header = nil - self._idle_clock = 0 + self._idle_clock = os.clock() end return end - self._idle_clock = self._idle_clock + 1 - if self._idle_clock == 1000 then + if os.clock() - self._idle_clock >= 1 then self:_buildTextCache() end end @@ -231,6 +230,6 @@ return function () _file = {}, _need_compile = {}, _header = nil, - _idle_clock = 0, + _idle_clock = os.clock(), }, mt) end |