From 5b1886a9cfa7c8dc1947bf7bb19e9fd3d04d604d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 7 Jan 2019 13:38:46 +0800 Subject: =?UTF-8?q?=E8=AE=B0=E5=BD=95Simple=E4=B8=AD=E7=9A=84=E7=82=B9?= =?UTF-8?q?=E4=B8=8E=E5=86=92=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 1 + server/src/core/vm.lua | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'server/src/core') diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 8fe3888e..34409bd5 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -334,6 +334,7 @@ local function findClosePos(vm, pos) type = 'name', start = pos, finish = pos, + object = parent.source.colon and parent, [1] = '', } local result = { diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 549fdc80..290125f1 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -1008,22 +1008,23 @@ function mt:getSimple(simple, mode) else parentName = ('%s[?]'):format(parentName) end - else - if tp == 'name' then - field = self:getField(value, obj[1], obj) - field.parentValue = value - value = self:getValue(field) - if mode == 'value' or i < #simple then - self:addInfo(field, 'get', obj) - end - field.parent = lastField - lastField = field - obj.object = object - obj.parentName = parentName - parentName = parentName .. '.' .. field.key - elseif tp == ':' then - object = field + elseif tp == 'name' then + field = self:getField(value, obj[1], obj) + field.parentValue = value + value = self:getValue(field) + if mode == 'value' or i < #simple then + self:addInfo(field, 'get', obj) end + field.parent = lastField + lastField = field + obj.object = object + obj.parentName = parentName + parentName = parentName .. '.' .. field.key + elseif tp == ':' then + object = field + field.source.colon = obj + elseif tp == '.' then + field.source.dot = obj end end if mode == 'value' then -- cgit v1.2.3