summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/method/textDocument/codeAction.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/server/src/method/textDocument/codeAction.lua b/server/src/method/textDocument/codeAction.lua
index e2ff2e50..c61ad88f 100644
--- a/server/src/method/textDocument/codeAction.lua
+++ b/server/src/method/textDocument/codeAction.lua
@@ -18,11 +18,7 @@ local function disableDiagnostic(lsp, uri, data, callback)
}
end
-local function solveUndefinedGlobal(lsp, uri, data, callback)
- local vm, lines, text = lsp:getVM(uri)
- if not vm then
- return
- end
+local function addGlobal(lines, text, data, callback)
local start = lines:position(data.range.start.line + 1, data.range.start.character + 1)
local finish = lines:position(data.range['end'].line + 1, data.range['end'].character)
local name = text:sub(start, finish)
@@ -46,6 +42,22 @@ local function solveUndefinedGlobal(lsp, uri, data, callback)
}
end
+local function solveUndefinedGlobal(lsp, uri, data, callback)
+ local vm, lines, text = lsp:getVM(uri)
+ if not vm then
+ return
+ end
+ addGlobal(lines, text, data, callback)
+end
+
+local function solveLowercaseGlobal(lsp, uri, data, callback)
+ local vm, lines, text = lsp:getVM(uri)
+ if not vm then
+ return
+ end
+ addGlobal(lines, text, data, callback)
+end
+
local function solveTrailingSpace(lsp, uri, data, callback)
callback {
title = lang.script.ACTION_REMOVE_SPACE,
@@ -116,6 +128,9 @@ local function solveDiagnostic(lsp, uri, data, callback)
if data.code == 'ambiguity-1' then
solveAmbiguity1(lsp, uri, data, callback)
end
+ if data.code == 'lowercase-global' then
+ solveLowercaseGlobal(lsp, uri, data, callback)
+ end
disableDiagnostic(lsp, uri, data, callback)
end