summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-05 20:16:08 +0800
committersumneko <sumneko@hotmail.com>2019-05-05 20:16:08 +0800
commitd64ec162e683c42befb2d32ae31b024e4d4a5510 (patch)
tree3960606296ef262fc9d5eaee49c10e6bb2c541ec /server
parent6b95bb52f39082e9df605a954cb6a16d75b9611c (diff)
downloadlua-language-server-d64ec162e683c42befb2d32ae31b024e4d4a5510.zip
修改未完成function在文件符号中的表现
Diffstat (limited to 'server')
-rw-r--r--server/src/core/document_symbol.lua6
-rw-r--r--server/src/parser/ast.lua12
-rw-r--r--server/test/document_symbol/init.lua22
3 files changed, 28 insertions, 12 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index 3c349246..48e01332 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -141,9 +141,6 @@ local function buildLocalFunction(vm, source, used, callback)
return
end
local name = getName(source.name)
- if name == '' then
- return
- end
local hvr = hoverFunction(name, value:getFunction())
if not hvr then
return
@@ -169,9 +166,6 @@ local function buildFunction(vm, source, used, callback)
return
end
local name = getName(source.name)
- if name == '' then
- return
- end
local func = value:getFunction()
if not func then
return
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index bf8f5dab..f361021b 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -738,8 +738,8 @@ local Defs = {
local last = args[max]
pushError {
type = 'MISS_NAME',
- start = last+1,
- finish = last+1,
+ start = last,
+ finish = last,
}
end
if #list == 0 then
@@ -1276,13 +1276,13 @@ local Defs = {
DirtyName = function (pos)
pushError {
type = 'MISS_NAME',
- start = pos,
- finish = pos,
+ start = pos-1,
+ finish = pos-1,
}
return {
type = 'name',
- start = pos,
- finish = pos,
+ start = pos-1,
+ finish = pos-1,
[1] = ''
}
end,
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua
index 09e533ac..3955a54f 100644
--- a/server/test/document_symbol/init.lua
+++ b/server/test/document_symbol/init.lua
@@ -444,6 +444,28 @@ local v = t
},
}
+TEST [[
+local x
+local function
+]]{
+ [1] = {
+ name = 'x',
+ detail = EXISTS,
+ kind = SymbolKind.Variable,
+ range = {7, 7},
+ selectionRange = {7, 7},
+ valueRange = {7, 7},
+ },
+ [2] = {
+ name = '',
+ detail = EXISTS,
+ kind = SymbolKind.Function,
+ range = {9, 22},
+ selectionRange = {22, 22},
+ valueRange = {9, 22},
+ }
+}
+
-- 临时
local fs = require 'bee.filesystem'
local function testIfExit(path)