summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/code-action.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index 3a7f7374..13d5220d 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -279,6 +279,34 @@ local function solveDiagnostic(uri, diag, results)
disableDiagnostic(uri, diag.code, results)
end
+local function checkSwapParams(results, uri, start, finish)
+ local ast = files.getAst(uri)
+ if not ast then
+ return
+ end
+ local result = guide.eachSourceBetween(ast.ast, start, finish, function (source)
+ if source.type == 'callargs' then
+ return {
+ node = source.parent.node,
+ args = source,
+ }
+ end
+ if source.type == 'funcargs' then
+ return {
+ node = source.parent,
+ args = source,
+ }
+ end
+ end)
+ if not result then
+ return
+ end
+end
+
+local function checkExtractAsFunction(results, uri, start, finish)
+
+end
+
return function (uri, start, finish, diagnostics)
local ast = files.getAst(uri)
if not ast then
@@ -291,5 +319,8 @@ return function (uri, start, finish, diagnostics)
solveDiagnostic(uri, diag, results)
end
+ checkSwapParams(results, uri, start, finish)
+ checkExtractAsFunction(results, uri, start, finish)
+
return results
end