diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 19:01:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-20 19:01:37 +0800 |
commit | da656036f0a6344f418778cede39c0ff14a7ca11 (patch) | |
tree | ea4edce2862d8e1cf81503caed32113e6113dfa5 | |
parent | 750834e2d06cd6a6a461987001be9cb991c89bc7 (diff) | |
download | lua-language-server-da656036f0a6344f418778cede39c0ff14a7ca11.zip |
要用另一个文件的行信息
-rw-r--r-- | server/src/matcher/vm.lua | 2 | ||||
-rw-r--r-- | server/src/method/textDocument/definition.lua | 9 | ||||
-rw-r--r-- | server/test/vm/normal.lua | 5 |
3 files changed, 11 insertions, 5 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 87f0139a..9e559fa7 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -309,7 +309,7 @@ function mt:getField(pValue, name, source) end function mt:buildFunction(exp, object) - local func = self:createValue('function') + local func = self:createValue('function', exp) func.args = {} func.argValues = {} diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index 6be93ff8..9115638b 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -15,11 +15,12 @@ return function (lsp, params) local locations = {} for i, position in ipairs(positions) do - local start, finish, valueUri = position[1], position[2], position[3] - local start_row, start_col = lines:rowcol(start) - local finish_row, finish_col = lines:rowcol(finish) + local start, finish, valueUri = position[1], position[2], (position[3] or uri) + local _, valueLines = lsp:loadVM(valueUri) + local start_row, start_col = valueLines:rowcol(start) + local finish_row, finish_col = valueLines:rowcol(finish) locations[i] = { - uri = valueUri or uri, + uri = valueUri, range = { start = { line = start_row - 1, diff --git a/server/test/vm/normal.lua b/server/test/vm/normal.lua index 20b73733..02b1f4f0 100644 --- a/server/test/vm/normal.lua +++ b/server/test/vm/normal.lua @@ -121,3 +121,8 @@ return { 1, 2, 3 } ]] + +TEST [[ +return function () +end +]] |