summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-11 17:16:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-11 17:16:57 +0800
commit4f98d5565b416f71d605cafcb22bd76cf697fd03 (patch)
treec31b78ccaab38f78f9ee6eb08970007d22211cbb /script/core
parent599065480e33e21e66d307b06e8f8deae101756e (diff)
downloadlua-language-server-4f98d5565b416f71d605cafcb22bd76cf697fd03.zip
fix #1035
Diffstat (limited to 'script/core')
-rw-r--r--script/core/code-action.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index 4b1ebd57..6bba0a82 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -415,6 +415,12 @@ local function checkSwapParams(results, uri, start, finish)
elseif source.type == 'funcargs' then
local var = source.parent.parent
if guide.isSet(var) then
+ if var.type == 'tablefield' then
+ var = var.field
+ end
+ if var.type == 'tableindex' then
+ var = var.index
+ end
node = text:sub(
guide.positionToOffset(state, var.start) + 1,
guide.positionToOffset(state, var.finish)