From abd2a22ef2fc4197aab1cdf0ccae386b55db3dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 30 Nov 2018 09:02:51 +0800 Subject: =?UTF-8?q?=E5=BA=94=E8=AF=A5=E5=88=A4=E6=96=AD=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/lsp.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server/src') 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 -- cgit v1.2.3