diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 22:02:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-05 22:02:19 +0800 |
commit | 19dd94e4af06254595a949a61c9bd05c5a911328 (patch) | |
tree | 98cd3650c148ec9cb0c568fd94f3f29e7586217b /script | |
parent | 5aace85b14473a161e9c64a410b06bf90d563762 (diff) | |
download | lua-language-server-19dd94e4af06254595a949a61c9bd05c5a911328.zip |
stash
Diffstat (limited to 'script')
-rw-r--r-- | script/core/code-action.lua | 31 |
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 |