summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-12-18 06:24:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-12-18 06:24:18 +0800
commitc95511b3efd6febc8642d51d7d0c971f7dc37c0e (patch)
tree3b4ed6eaa6167c68e5078a1a0468daa101048219 /script
parentbf65753f457634d27f2cc4cc60ac68838ca0f9b5 (diff)
downloadlua-language-server-c95511b3efd6febc8642d51d7d0c971f7dc37c0e.zip
rename: supports `@field`
Diffstat (limited to 'script')
-rw-r--r--script/core/rename.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/script/core/rename.lua b/script/core/rename.lua
index 3d24b90c..98895826 100644
--- a/script/core/rename.lua
+++ b/script/core/rename.lua
@@ -178,6 +178,11 @@ local function ofFieldThen(key, src, newname, callback)
if not suc then
return
end
+ elseif src.type == 'doc.field' then
+ local suc = renameField(src.field, newname, callback)
+ if not suc then
+ return
+ end
end
end
@@ -282,6 +287,8 @@ local function rename(source, newname, callback)
return ofDocTypeName(source, newname, callback)
elseif source.type == 'doc.param.name' then
return ofDocParamName(source, newname, callback)
+ elseif source.type == 'doc.field.name' then
+ return ofField(source, newname, callback)
elseif source.type == 'string'
or source.type == 'number'
or source.type == 'integer'
@@ -313,7 +320,8 @@ local function prepareRename(source)
or source.type == 'doc.type.name'
or source.type == 'doc.alias.name'
or source.type == 'doc.enum.name'
- or source.type == 'doc.param.name' then
+ or source.type == 'doc.param.name'
+ or source.type == 'doc.field.name' then
return source, source[1]
elseif source.type == 'string'
or source.type == 'number'
@@ -354,6 +362,7 @@ local accept = {
['doc.alias.name'] = true,
['doc.param.name'] = true,
['doc.enum.name'] = true,
+ ['doc.field.name'] = true,
}
local m = {}