summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-07-23 15:42:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-07-23 15:42:48 +0800
commiteb1f2fb5be64a4a0ead1bb421bf5c68524f8d5e3 (patch)
tree3c709158581750648d3075414489c138628351d4 /server/src
parent7ca97acc2a6cdd1bb99cb3bc7942aa392b858b61 (diff)
downloadlua-language-server-eb1f2fb5be64a4a0ead1bb421bf5c68524f8d5e3.zip
缺失的那边也要
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/code_action.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/src/core/code_action.lua b/server/src/core/code_action.lua
index 7291e3a7..465d5b6f 100644
--- a/server/src/core/code_action.lua
+++ b/server/src/core/code_action.lua
@@ -246,7 +246,7 @@ local function solveSyntaxByFix(uri, err, lines, callback)
}
end
-local function findEndPosition(err, lines, row, endrow)
+local function findEndPosition(lines, row, endrow)
if endrow == row then
return {
newText = ' end',
@@ -279,8 +279,8 @@ local function findEndPosition(err, lines, row, endrow)
end
end
-local function solveSyntaxByAddEnd(uri, err, lines, callback)
- local row = lines:rowcol(err.start)
+local function solveSyntaxByAddEnd(uri, start, lines, callback)
+ local row = lines:rowcol(start)
local line = lines[row]
if not line then
return nil
@@ -296,7 +296,7 @@ local function solveSyntaxByAddEnd(uri, err, lines, callback)
edit = {
changes = {
[uri] = {
- findEndPosition(err, lines, row, i - 1)
+ findEndPosition(lines, row, i - 1)
}
}
}
@@ -331,7 +331,10 @@ local function solveSyntax(lsp, uri, data, callback)
solveSyntaxByAddDoEnd(uri, data, callback)
end
if err.type == 'MISS_END' then
- solveSyntaxByAddEnd(uri, err, lines, callback)
+ solveSyntaxByAddEnd(uri, err.start, lines, callback)
+ end
+ if err.type == 'MISS_SYMBOL' and err.info.symbol == 'end' then
+ solveSyntaxByAddEnd(uri, err.info.related[1], lines, callback)
end
if err.fix then
solveSyntaxByFix(uri, err, lines, callback)