diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 11:28:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 11:28:55 +0800 |
commit | 37c2aaca32959f6c7862d7120379482f3ce811a3 (patch) | |
tree | a5ad70081609e00f26d6353fdbe91e325c0a02cb /server | |
parent | 8a35083984d52052aebfbb7283ed62de0d30b79c (diff) | |
download | lua-language-server-37c2aaca32959f6c7862d7120379482f3ce811a3.zip |
修正寻找引用的bug
Diffstat (limited to 'server')
-rw-r--r-- | server/main.lua | 2 | ||||
-rw-r--r-- | server/src/core/references.lua | 8 | ||||
-rw-r--r-- | server/src/service.lua | 1 | ||||
-rw-r--r-- | server/test/references/init.lua | 7 |
4 files changed, 12 insertions, 6 deletions
diff --git a/server/main.lua b/server/main.lua index 4f3dcf71..35b75789 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,7 +6,7 @@ LANG = LANG or 'en-US' package.path = (ROOT / 'src' / '?.lua'):string() .. ';' .. (ROOT / 'src' / '?' / 'init.lua'):string() ---collectgarbage('generational') +collectgarbage('generational') log = require 'log' log.init(ROOT, ROOT / 'log' / 'service.log') diff --git a/server/src/core/references.lua b/server/src/core/references.lua index 755612b5..bc6cc39e 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -3,7 +3,7 @@ local findSource = require 'core.find_source' local function parseResult(vm, source, declarat, callback) if source:bindLabel() then source:bindLabel():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and info.type == 'set') or info.type == 'get' then callback(src) end end) @@ -12,12 +12,12 @@ local function parseResult(vm, source, declarat, callback) if source:bindLocal() then local loc = source:bindLocal() loc:eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and info.type == 'set') or info.type == 'get' then callback(src) end end) loc:getValue():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then callback(src) end end) @@ -25,7 +25,7 @@ local function parseResult(vm, source, declarat, callback) end if source:bindValue() then source:bindValue():eachInfo(function (info, src) - if declarat or info.type == 'get' then + if (declarat and (info.type == 'set' or info.type == 'local')) or info.type == 'get' then callback(src) end end) diff --git a/server/src/service.lua b/server/src/service.lua index 8b07aa33..20e1a921 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -534,7 +534,6 @@ function mt:onTick() self:_doCompileTask() if os.clock() - self._clock >= 60 then - collectgarbage() self._clock = os.clock() local count = 0 for _ in pairs(self._file) do diff --git a/server/test/references/init.lua b/server/test/references/init.lua index 59026031..bcaafbbc 100644 --- a/server/test/references/init.lua +++ b/server/test/references/init.lua @@ -78,3 +78,10 @@ local t = { } print(t.<!a!>) ]] + +TEST [[ +local <!mt!> = {} +function <!mt!>:a() + <?self?>:remove() +end +]] |