@@ -50,8 +50,9 @@ local function move(src, src_path, src_pos, dst, dst_path, dst_pos, remove)
5050 end
5151end
5252
53- -- silently move, please add to help nvim-tree-legacy-opts
54- local function refactored (opts )
53+ -- silently move, please add to help nvim-tree-legacy-config
54+ --- @param opts nvim_tree.config user supplied subset of config
55+ local function refactored_config (opts )
5556 -- 2022/06/20
5657 move (opts , " update_focused_file" , " update_cwd" , opts , " update_focused_file" , " update_root" , true )
5758 move (opts , " " , " update_cwd" , opts , " " , " sync_root_with_cwd" , true )
@@ -73,12 +74,12 @@ local function refactored(opts)
7374 -- 2023/01/15
7475 if type (opts .view ) == " table" and opts .view .adaptive_size ~= nil then
7576 if opts .view .adaptive_size and type (opts .view .width ) ~= " table" then
76- local width = opts .view .width
77+ local width = opts .view .width --[[ @as nvim_tree.config.view.width.spec ]]
7778 opts .view .width = {
7879 min = width ,
7980 }
8081 end
81- opts .view . adaptive_size = nil
82+ opts .view [ " adaptive_size" ] = nil
8283 end
8384
8485 -- 2023/07/15
@@ -103,55 +104,57 @@ local function refactored(opts)
103104 -- 2024/02/15
104105 if type (opts .update_focused_file ) == " table" then
105106 if type (opts .update_focused_file .update_root ) ~= " table" then
106- opts .update_focused_file .update_root = { enable = opts .update_focused_file .update_root }
107+ opts .update_focused_file .update_root = { enable = opts .update_focused_file .update_root == true }
107108 end
108109 end
109110 move (opts , " update_focused_file" , " ignore_list" , opts , " update_focused_file.update_root" , " ignore_list" , true )
110111
111112 -- 2025/04/30
112113 if opts .renderer and opts .renderer .icons and type (opts .renderer .icons .padding ) == " string" then
113- local icons_padding = opts .renderer .icons .padding
114+ local icons_padding = opts .renderer .icons .padding --[[ @as string ]]
114115 opts .renderer .icons .padding = {}
115116 opts .renderer .icons .padding .icon = icons_padding
116117 end
117118end
118119
119- local function deprecated (opts )
120+ --- @param opts nvim_tree.config user supplied subset of config
121+ local function deprecated_config (opts )
120122 if type (opts .view ) == " table" and opts .view .hide_root_folder then
121123 notify .info (" view.hide_root_folder is deprecated, please set renderer.root_folder_label = false" )
122124 end
123125end
124126
125- local function removed (opts )
127+ --- @param opts nvim_tree.config user supplied subset of config
128+ local function removed_config (opts )
126129 if opts .auto_close then
127130 notify .warn (" auto close feature has been removed: https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close" )
128- opts . auto_close = nil
131+ opts [ " auto_close" ] = nil
129132 end
130133
131134 if opts .focus_empty_on_setup then
132135 notify .warn (" focus_empty_on_setup has been removed: https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup" )
133- opts . focus_empty_on_setup = nil
136+ opts [ " focus_empty_on_setup" ] = nil
134137 end
135138
136139 if opts .create_in_closed_folder then
137140 notify .warn (
138141 " create_in_closed_folder has been removed and is now the default behaviour. You may use api.fs.create to add a file under your desired node." )
139142 end
140- opts . create_in_closed_folder = nil
143+ opts [ " create_in_closed_folder" ] = nil
141144end
142145
143146--- Migrate legacy config in place.
144147--- Refactored are silently migrated. Deprecated and removed result in a warning.
145148--- @param opts nvim_tree.config user supplied subset of config
146- function M .migrate_legacy_options (opts )
149+ function M .migrate_config (opts )
147150 -- silently move
148- refactored (opts )
151+ refactored_config (opts )
149152
150153 -- warn
151- deprecated (opts )
154+ deprecated_config (opts )
152155
153156 -- warn and delete
154- removed (opts )
157+ removed_config (opts )
155158end
156159
157160--- Silently create new api entries pointing legacy functions to current
0 commit comments