summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/completion.lua42
-rw-r--r--server/src/matcher/hover.lua2
-rw-r--r--server/src/parser/grammar.lua9
3 files changed, 31 insertions, 22 deletions
diff --git a/server/src/matcher/completion.lua b/server/src/matcher/completion.lua
index 9e9d7919..4b12c789 100644
--- a/server/src/matcher/completion.lua
+++ b/server/src/matcher/completion.lua
@@ -389,22 +389,7 @@ local function findCall(vm, pos)
return results
end
-return function (vm, pos)
- local result, source = findResult(vm, pos)
- if not result then
- result, source = findClosePos(vm, pos)
- if not result then
- return nil
- end
- end
-
- local inCall
- local calls = findCall(vm, pos)
- if calls then
- inCall = calls[#calls]
- end
- local inString = getString(vm, pos)
-
+local function makeList(source)
local list = {}
local mark = {}
local function callback(var, defualt, detail, documentation)
@@ -434,12 +419,35 @@ return function (vm, pos)
}
end
end
+ return list, callback
+end
+
+return function (vm, pos)
+ local result, source = findResult(vm, pos)
+ local closeResult, closeSource = findClosePos(vm, pos)
+
+ if not result and not closeResult then
+ return nil
+ end
+
+ local inCall
+ local calls = findCall(vm, pos)
+ if calls then
+ inCall = calls[#calls]
+ end
+ local inString = getString(vm, pos)
+
+ local list, callback = makeList(source or closeSource)
if inCall then
searchInArg(vm, inCall, inString, callback)
end
- if result and not inString then
+ if not inString then
+ if not result then
+ result = closeResult
+ source = closeSource
+ end
if result.type == 'local' then
if source.isArg then
searchAsArg(vm, pos, result, callback)
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index 9c06829d..900f9227 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -405,7 +405,7 @@ local function getValueHover(name, valueType, result, source, lib)
local tp = result.type
if tp == 'field' then
- if result.parent.value.ENV then
+ if result.parent and result.parent.value and result.parent.value.ENV then
tp = 'global'
end
end
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 32be697b..4a483514 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -247,8 +247,9 @@ ExpBshift <- (ExpConcat (Bshift ExpConcat)*) -> Binary
ExpConcat <- (ExpAdds (Concat ExpConcat)*) -> Binary
ExpAdds <- (ExpMuls (Adds ExpMuls)*) -> Binary
ExpMuls <- (ExpUnary (Muls ExpUnary)*) -> Binary
-ExpUnary <- ( (Unary+ ExpPower)) -> Unary
- / ExpPower
+ExpUnary <- ( (Unary+ (ExpPower / DirtyName)))
+ -> Unary
+ / ExpPower
ExpPower <- (ExpUnit (POWER ExpUnary)*) -> Binary
ExpUnit <- Nil
/ Boolean
@@ -267,7 +268,7 @@ Suffix <- DOT MustName
/ COLON MustName
/ Sp ({} Table {}) -> Call
/ Sp ({} String {}) -> Call
- / BL Exp -> Index BR
+ / BL DirtyExp -> Index BR?
/ Sp ({} PL ExpList (PR / Sp) {}) -> Call
DirtyExp <- Exp / DirtyName
@@ -377,7 +378,7 @@ ElseIfPart <- ELSEIF Exp THEN
{} (!ELSE !ELSEIF Action)* {}
/ ELSEIF DirtyExp THEN
{} (!ELSE !ELSEIF Action)* {}
- / ELSEIF DirtyExp THEN
+ / ELSEIF DirtyExp
{} {}
ElsePart <- ELSE
{} Action* {}