diff options
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/definition.lua | 51 | ||||
-rw-r--r-- | server/src/core/implementation.lua | 48 | ||||
-rw-r--r-- | server/src/core/references.lua | 5 | ||||
-rw-r--r-- | server/src/method/textDocument/completion.lua | 2 |
4 files changed, 79 insertions, 27 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index abf0b3f6..87bdc097 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -95,7 +95,7 @@ end local function parseLocal(vm, source, lsp) local loc = source:bindLocal() local value = source:bindValue() - if value.uri ~= '' and value.uri ~= vm.uri then + if value.uri ~= vm.uri then return parseValueCrossFile(vm, source, lsp) end local positions = {} @@ -111,19 +111,45 @@ local function parseLocal(vm, source, lsp) end local function parseValue(vm, source, lsp) - local value = source:bindValue() - if value.uri ~= '' and value.uri ~= vm.uri then - return parseValueCrossFile(vm, source, lsp) - end local positions = {} - value:eachInfo(function (info, src) - if info.type == 'set' then - positions[#positions+1] = { - src.start, - src.finish, - } + local mark = {} + + local function callback(src) + if mark[src] then + return end - end) + mark[src] = true + if src.start == 0 then + return + end + local uri = src.uri + if uri == '' then + uri = nil + end + positions[#positions+1] = { + src.start, + src.finish, + uri, + } + end + + if source:bindValue() then + source:bindValue():eachInfo(function (info, src) + if info.type == 'set' or info.type == 'local' then + callback(src) + end + end) + end + local parent = source:get 'parent' + if parent then + parent:eachInfo(function (info, src) + if info[1] == source[1] then + if info.type == 'set child' then + callback(src) + end + end + end) + end if #positions == 0 then return nil end @@ -173,7 +199,6 @@ return function (vm, source, lsp) return jumpUri(vm, source, lsp) end if source:get 'in index' then - source = source:get 'in index' return parseValue(vm, source, lsp) or parseValueSimily(vm, source, lsp) end diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua index 36a990ee..b0fa6e9e 100644 --- a/server/src/core/implementation.lua +++ b/server/src/core/implementation.lua @@ -93,19 +93,45 @@ local function parseValueCrossFile(vm, source, lsp) end local function parseValue(vm, source, lsp) - local value = source:bindValue() - if value.uri ~= '' and value.uri ~= vm.uri then - return parseValueCrossFile(vm, source, lsp) - end local positions = {} - value:eachInfo(function (info, src) - if info.type == 'set' then - positions[#positions+1] = { - src.start, - src.finish, - } + local mark = {} + + local function callback(src) + if mark[src] then + return end - end) + mark[src] = true + if src.start == 0 then + return + end + local uri = src.uri + if uri == '' then + uri = nil + end + positions[#positions+1] = { + src.start, + src.finish, + uri, + } + end + + if source:bindValue() then + source:bindValue():eachInfo(function (info, src) + if info.type == 'set' or info.type == 'local' then + callback(src) + end + end) + end + local parent = source:get 'parent' + if parent then + parent:eachInfo(function (info, src) + if info[1] == source[1] then + if info.type == 'set child' then + callback(src) + end + end + end) + end if #positions == 0 then return nil end diff --git a/server/src/core/references.lua b/server/src/core/references.lua index 26d65bf1..dfd26575 100644 --- a/server/src/core/references.lua +++ b/server/src/core/references.lua @@ -30,7 +30,9 @@ local function parseResult(vm, source, declarat, callback) callback(src) end end) - local parent = source:get 'parent' + end + local parent = source:get 'parent' + if parent then parent:eachInfo(function (info, src) if info[1] == source[1] then if (declarat and info.type == 'set child') or info.type == 'get child' then @@ -38,7 +40,6 @@ local function parseResult(vm, source, declarat, callback) end end end) - return end end diff --git a/server/src/method/textDocument/completion.lua b/server/src/method/textDocument/completion.lua index c0fcfb44..0b559145 100644 --- a/server/src/method/textDocument/completion.lua +++ b/server/src/method/textDocument/completion.lua @@ -99,7 +99,7 @@ return function (lsp, params) end local response = { - isIncomplete = false, + isIncomplete = true, items = items, } return response |