summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/lsp.lua2
-rw-r--r--server/src/matcher/definition.lua28
2 files changed, 21 insertions, 9 deletions
diff --git a/server/src/lsp.lua b/server/src/lsp.lua
index 01aa8814..7bdde99d 100644
--- a/server/src/lsp.lua
+++ b/server/src/lsp.lua
@@ -75,6 +75,7 @@ function mt:_readProtoContent(header)
local id = res.id
local method = res.method
local params = res.params
+ log.debug('recive', id)
local response, err = self:_callback(method, params)
if id then
if response then
@@ -91,6 +92,7 @@ function mt:_readProtoContent(header)
},
}
end
+ log.debug('send', id)
end
if response == nil then
log.error(err or ('没有回应:' .. method))
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua
index 6c2f64b4..a7e51121 100644
--- a/server/src/matcher/definition.lua
+++ b/server/src/matcher/definition.lua
@@ -19,6 +19,9 @@ function mt:getVar(key, source)
end
function mt:addVarInfo(var, info)
+ if not var then
+ return nil
+ end
var[#var+1] = info
return var
end
@@ -197,12 +200,24 @@ function mt:markSimple(simple)
elseif tp == 'name' then
if not obj.index then
var = self:addField(var, obj[1], obj)
+ if i == #simple then
+ self:addVarInfo(var, {
+ type = 'set',
+ source = obj,
+ })
+ end
else
var = nil
end
else
if obj.index then
var = self:addField(var, obj[1], obj)
+ if i == #simple then
+ self:addVarInfo(var, {
+ type = 'set',
+ source = obj,
+ })
+ end
else
var = nil
end
@@ -407,17 +422,12 @@ local function parseResult(result)
end
results[1] = {source.start, source.finish}
elseif var.type == 'field' then
- local source = var.source
- if not source then
+ if #var == 0 then
return false
end
- if #var == 0 then
- results[1] = {source.start, source.finish}
- else
- for i, info in ipairs(var) do
- if info.type == 'set' then
- results[i] = {info.source.start, info.source.finish}
- end
+ for i, info in ipairs(var) do
+ if info.type == 'set' then
+ results[i] = {info.source.start, info.source.finish}
end
end
else