diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-12-18 06:24:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-12-18 06:24:18 +0800 |
commit | c95511b3efd6febc8642d51d7d0c971f7dc37c0e (patch) | |
tree | 3b4ed6eaa6167c68e5078a1a0468daa101048219 /script | |
parent | bf65753f457634d27f2cc4cc60ac68838ca0f9b5 (diff) | |
download | lua-language-server-c95511b3efd6febc8642d51d7d0c971f7dc37c0e.zip |
rename: supports `@field`
Diffstat (limited to 'script')
-rw-r--r-- | script/core/rename.lua | 11 |
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 = {} |