Skip to content

Commit 76c43f4

Browse files
authored
fix!: fix and deprecate old reveal_current_file methods (#1099)
BREAKING CHANGE: deprecated `neo-tree.sources.manager.reveal_current_file()` and `...reveal_in_split()`, removed `neo-tree.reveal_current_file`
1 parent 38293fe commit 76c43f4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lua/neo-tree/sources/filesystem/init.lua

-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ local get_state = function(tabid)
2424
return manager.get_state(M.name, tabid)
2525
end
2626

27-
-- TODO: DEPRECATED in 1.19, remove in 2.0
28-
-- Leaving this here for now because it was mentioned in the help file.
29-
M.reveal_current_file = function()
30-
log.warn("DEPRECATED: use `neotree.sources.manager.reveal_current_file('filesystem')` instead")
31-
return manager.reveal_current_file(M.name)
32-
end
33-
3427
local follow_internal = function(callback, force_show, async)
3528
log.trace("follow called")
3629
local state = get_state()

lua/neo-tree/sources/manager.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,11 @@ M.refresh = function(source_name, callback)
517517
end
518518
end
519519

520+
--- DEPRECATED: To be removed in 4.0
521+
--- use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true })` instead
520522
M.reveal_current_file = function(source_name, callback, force_cwd)
523+
log.warn([[DEPRECATED: use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true })` instead]])
524+
521525
log.trace("Revealing current file")
522526
local state = M.get_state(source_name)
523527
state.current_position = nil
@@ -527,7 +531,6 @@ M.reveal_current_file = function(source_name, callback, force_cwd)
527531
-- (potentially) different position/node
528532
state.position.is.restorable = false
529533

530-
require("neo-tree").close_all_except(source_name)
531534
local path = M.get_path_to_reveal()
532535
if not path then
533536
M.focus(source_name)
@@ -560,7 +563,11 @@ M.reveal_current_file = function(source_name, callback, force_cwd)
560563
end
561564
end
562565

566+
--- DEPRECATED: To be removed in 4.0
567+
--- use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true, position = "current" })` instead
563568
M.reveal_in_split = function(source_name, callback)
569+
log.warn([[DEPRECATED: use `require("neo-tree.command").execute({ source_name = source_name, action = "focus", reveal = true, position = "current" })` instead]])
570+
564571
local state = M.get_state(source_name, nil, vim.api.nvim_get_current_win())
565572
state.current_position = "current"
566573
local path_to_reveal = M.get_path_to_reveal()

0 commit comments

Comments
 (0)