Skip to content

Commit 4038769

Browse files
committed
Use SideBarEnhancements delete function if it is installed since it disables the default command
1 parent fab448d commit 4038769

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

advanced_new_file/commands/delete_file_command.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sublime
33
import sublime_plugin
4+
import sys
45
from ..anf_util import *
56
from .git.git_command_base import GitCommandBase
67
from .command_base import AdvancedNewFileBase
@@ -60,10 +61,19 @@ def _delete_file(self, filepath):
6061
if vcs_tracking:
6162
self._git_rm(filepath)
6263
else:
63-
self.window.run_command("delete_file", {"files": [filepath]})
64+
command = self._delete_file_command()
65+
self.window.run_command(command, {"files": [filepath]})
6466

6567
self.refresh_sidebar()
6668

69+
def _delete_file_command(self):
70+
if IS_ST3 and self._side_bar_enhancements_installed():
71+
return "side_bar_delete"
72+
return "delete_file"
73+
74+
def _side_bar_enhancements_installed(self):
75+
return "SideBarEnhancements.SideBar" in sys.modules
76+
6777
def close_view(self, filepath):
6878
file_view = self._find_open_file(filepath)
6979

0 commit comments

Comments
 (0)