summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/parser/ast.lua11
-rw-r--r--server/src/parser/grammar.lua5
-rw-r--r--server/src/workspace.lua1
-rw-r--r--server/test/crossfile/definition.lua25
-rw-r--r--server/test/full/dirty.lua8
5 files changed, 47 insertions, 3 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 55364ca9..f7a94dfc 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -1235,6 +1235,17 @@ local Defs = {
symbol = symbol,
}
}
+ return
+ end,
+ UnknownAction = function (start, symbol)
+ pushError {
+ type = 'UNKNOWN_SYMBOL',
+ start = start,
+ finish = start + #symbol - 1,
+ info = {
+ symbol = symbol,
+ }
+ }
return false
end,
DirtyName = function (pos)
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 42e52d05..b5e083e6 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -55,6 +55,7 @@ defs.er = '\r'
defs.et = '\t'
defs.ev = '\v'
defs['nil'] = m.Cp() / function () return nil end
+defs['false'] = m.Cp() / function () return false end
defs.NotReserved = function (_, _, str)
if RESERVED[str] then
return false
@@ -386,9 +387,9 @@ CrtAction <- Semicolon
/ Call
/ ExpInAction
UnkAction <- ({} {Word+})
- -> UnknownSymbol
+ -> UnknownAction
/ ({} {. (!Sps !CrtAction .)*})
- -> UnknownSymbol
+ -> UnknownAction
ExpInAction <- Sp ({} Exp {})
-> ExpInAction
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index 16649939..1efa16f0 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -408,6 +408,7 @@ function mt:matchPath(baseUri, input)
end
function mt:searchPath(baseUri, str)
+ str = getFileName(fs.path(str))
if self.searched[baseUri] and self.searched[baseUri][str] then
return self.searched[baseUri][str]
end
diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua
index f49530ea..9310c323 100644
--- a/server/test/crossfile/definition.lua
+++ b/server/test/crossfile/definition.lua
@@ -89,7 +89,7 @@ function TEST(datas)
local sourceVM = lsp:getVM(sourceUri)
assert(sourceVM)
local sourcePos = (sourceList[1][1] + sourceList[1][2]) // 2
- local positions = core.definition(sourceVM, sourcePos, 'definition', lsp)
+ local positions = core.definition(sourceVM, sourcePos, 'definition')
if positions then
assert(founded(targetList, positions))
else
@@ -123,6 +123,29 @@ TEST {
TEST {
{
path = 'a.lua',
+ content = '',
+ target = {0, 0},
+ },
+ {
+ path = 'b.lua',
+ content = 'require <?"A"?>',
+ },
+}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = 'local <!t!> = 1; return <!t!>',
+ },
+ {
+ path = 'b.lua',
+ content = 'local <?t?> = require "a"',
+ },
+}
+
+TEST {
+ {
+ path = 'a.lua',
content = [[
local t = {
<!x!> = 1,
diff --git a/server/test/full/dirty.lua b/server/test/full/dirty.lua
index 9c2e65fb..5fe4e998 100644
--- a/server/test/full/dirty.lua
+++ b/server/test/full/dirty.lua
@@ -5,3 +5,11 @@ a.
TEST [[
a:
]]
+
+TEST [[
+end
+]]
+
+TEST [[
+table.02X
+]]