diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-23 15:05:07 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-23 15:05:07 +0800 |
commit | 7b543e55d63de2ee64f96a86f087ff5b108332a6 (patch) | |
tree | a5b9410965f281b1b7a9d178b968e10e0fdd74d6 | |
parent | 89f26bfd51199ac8ac34a358d70563897e5b8d57 (diff) | |
download | lua-language-server-7b543e55d63de2ee64f96a86f087ff5b108332a6.zip |
修正库函数跳转到不存在文件的bug
-rw-r--r-- | server/src/core/definition.lua | 4 | ||||
-rw-r--r-- | server/src/method/textDocument/definition.lua | 4 | ||||
-rw-r--r-- | server/src/method/textDocument/references.lua | 4 | ||||
-rw-r--r-- | server/src/vm/source.lua | 2 |
4 files changed, 5 insertions, 9 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 6b66ed56..87fed2dd 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -216,10 +216,6 @@ local function makeList(source) return end mark[src] = true - local uri = src.uri - if uri == '' then - uri = nil - end list[#list+1] = { src.start, src.finish, diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index 20b2191f..d37a3cb9 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -22,7 +22,7 @@ local function findResult(lsp, params) local locations = {} for i, position in ipairs(positions) do local start, finish, valueUri = position[1], position[2], (position[3] or uri) - local _, valueLines = lsp:loadVM(valueUri) + local vm, valueLines = lsp:loadVM(valueUri) if valueLines then local start_row, start_col = valueLines:rowcol(start) local finish_row, finish_col = valueLines:rowcol(finish) @@ -40,7 +40,7 @@ local function findResult(lsp, params) }, } } - else + elseif vm then locations[#locations+1] = { uri = valueUri, range = { diff --git a/server/src/method/textDocument/references.lua b/server/src/method/textDocument/references.lua index ca4bed87..437aa21e 100644 --- a/server/src/method/textDocument/references.lua +++ b/server/src/method/textDocument/references.lua @@ -12,7 +12,7 @@ local function findReferences(lsp, uri, position, declarat) local locations = {} for i, position in ipairs(positions) do local start, finish, valueUri = position[1], position[2], (position[3] or uri) - local _, valueLines = lsp:getVM(valueUri) + local vm, valueLines = lsp:getVM(valueUri) if valueLines then local start_row, start_col = valueLines:rowcol(start) local finish_row, finish_col = valueLines:rowcol(finish) @@ -30,7 +30,7 @@ local function findReferences(lsp, uri, position, declarat) }, } } - else + elseif vm then locations[#locations+1] = { uri = valueUri, range = { diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua index a969079b..7f355c6b 100644 --- a/server/src/vm/source.lua +++ b/server/src/vm/source.lua @@ -3,7 +3,7 @@ local listMgr = require 'vm.list' local mt = {} mt.__index = mt mt.type = 'source' -mt.uri = '@dummy' +mt.uri = '' mt.start = 0 mt.finish = 0 mt.id = 0 |