diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-21 16:13:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-21 16:13:17 +0800 |
commit | 961d11ad4bd4834dab7a7108dc95298331374fe8 (patch) | |
tree | 6136ac2f35efb10b52ccf34ddd15d890fb3e0043 | |
parent | 0cbeef42edd65845900a7b51254b902c3f798e5c (diff) | |
download | lua-language-server-961d11ad4bd4834dab7a7108dc95298331374fe8.zip |
修正一个缓存bug
-rw-r--r-- | server/src/core/definition.lua | 9 | ||||
-rw-r--r-- | server/src/core/implementation.lua | 9 | ||||
-rw-r--r-- | server/src/method/textDocument/completion.lua | 11 |
3 files changed, 17 insertions, 12 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 9c3f9a2f..44f4813a 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -75,11 +75,11 @@ end local function parseResult(vm, result, lsp) local positions = {} - if result.value.lib then - return positions - end local tp = result.type if tp == 'local' then + if result.value.lib then + return positions + end if result.value.uri ~= vm.uri then parseResultAcrossUri(positions, vm, result) else @@ -94,6 +94,9 @@ local function parseResult(vm, result, lsp) end end elseif tp == 'field' then + if result.value.lib then + return positions + end if result.value.uri ~= vm.uri then parseResultAcrossUri(positions, vm, result) else diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua index 8f52cc38..d3681652 100644 --- a/server/src/core/implementation.lua +++ b/server/src/core/implementation.lua @@ -74,11 +74,11 @@ end local function parseResult(vm, result, lsp) local positions = {} - if result.value.lib then - return positions - end local tp = result.type if tp == 'local' then + if result.value.lib then + return positions + end if result.value.uri ~= vm.uri then parseResultAcrossUri(positions, vm, result) else @@ -93,6 +93,9 @@ local function parseResult(vm, result, lsp) end end elseif tp == 'field' then + if result.value.lib then + return positions + end if result.value.uri ~= vm.uri then parseResultAcrossUri(positions, vm, result) else diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua index 2891b4b2..2e1eb5f0 100644 --- a/server/src/method/textDocument/completion.lua +++ b/server/src/method/textDocument/completion.lua @@ -17,18 +17,17 @@ local function posToRange(lines, start, finish) end local function findStartPos(pos, buf) + local res = pos for i = pos-1, 1, -1 do local c = buf:sub(i, i) if c:find '%a' then - goto CONTINUE + res = i end - if c == '.' then - return nil + if c == '.' or c == ':' then + break end - do return i + 1 end - ::CONTINUE:: end - return pos + return res end return function (lsp, params) |