diff --git a/Default.sublime-commands b/Default.sublime-commands index 631920f88..2f64684d2 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -153,7 +153,7 @@ }, { "caption": "LSP: Rename File", - "command": "lsp_rename_path" + "command": "lsp_rename_file" }, { "caption": "LSP: Code Action", diff --git a/Side Bar.sublime-menu b/Side Bar.sublime-menu deleted file mode 100644 index ae55009a7..000000000 --- a/Side Bar.sublime-menu +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "caption": "LSP: Rename...", - "mnemonic": "l", - "command": "lsp_rename_path_sidebar", - "args": {"paths": []} - } -] diff --git a/boot.py b/boot.py index 020add216..16ce854b0 100644 --- a/boot.py +++ b/boot.py @@ -69,8 +69,8 @@ from .plugin.references import LspSymbolReferencesCommand from .plugin.rename import LspHideRenameButtonsCommand from .plugin.rename import LspSymbolRenameCommand +from .plugin.rename_file import LspRenameFileCommand from .plugin.rename_file import LspRenamePathCommand -from .plugin.rename_file import LspRenamePathSidebarCommand from .plugin.save_command import LspSaveAllCommand from .plugin.save_command import LspSaveCommand from .plugin.selection_range import LspExpandSelectionCommand @@ -148,8 +148,8 @@ "LspSymbolImplementationCommand", "LspSymbolReferencesCommand", "LspSymbolRenameCommand", + "LspRenameFileCommand", "LspRenamePathCommand", - "LspRenamePathSidebarCommand", "LspSymbolTypeDefinitionCommand", "LspToggleCodeLensesCommand", "LspToggleHoverPopupsCommand", @@ -265,6 +265,10 @@ def on_pre_close(self, view: sublime.View) -> None: tup[1](None) break + def on_window_command(self, window: sublime.Window, command_name: str, args: dict) -> tuple[str, dict] | None: + if command_name == "rename_path": + return ("lsp_rename_path", args) + def on_post_window_command(self, window: sublime.Window, command_name: str, args: dict[str, Any] | None) -> None: if command_name == "show_panel": wm = windows.lookup(window) diff --git a/plugin/rename_file.py b/plugin/rename_file.py index ff791089e..799bb7a69 100644 --- a/plugin/rename_file.py +++ b/plugin/rename_file.py @@ -12,7 +12,7 @@ import functools -class LspRenamePathSidebarCommand(LspWindowCommand): +class LspRenamePathCommand(LspWindowCommand): def run(self, paths: list[str] | None = None) -> None: old_path = paths[0] if paths else None path_name = Path(old_path or "").name @@ -28,7 +28,7 @@ def run(self, paths: list[str] | None = None) -> None: def on_done(self, old_path: str | None, new_name: str) -> None: if new_name: - self.window.run_command('lsp_rename_path', { + self.window.run_command('lsp_rename_file', { "new_name": new_name, "old_path": old_path }) @@ -55,7 +55,7 @@ def validate(self, path: str) -> bool: return len(path) > 0 -class LspRenamePathCommand(LspWindowCommand): +class LspRenameFileCommand(LspWindowCommand): capability = 'workspace.fileOperations.willRename' def is_enabled(self):