From 7b543e55d63de2ee64f96a86f087ff5b108332a6 Mon Sep 17 00:00:00 2001 From: sumneko Date: Tue, 23 Apr 2019 15:05:07 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BA=93=E5=87=BD=E6=95=B0=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/definition.lua | 4 ---- server/src/method/textDocument/definition.lua | 4 ++-- server/src/method/textDocument/references.lua | 4 ++-- server/src/vm/source.lua | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'server/src') 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 -- cgit v1.2.3