From 4785d4938c2b4abc715a4e6f3291b0ca323f534e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=80=D0=B0=D0=B3=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=9B?= Date: Tue, 2 Jul 2024 15:03:52 +0200 Subject: [PATCH] remomve few lines --- plugin/rename_file.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/plugin/rename_file.py b/plugin/rename_file.py index aa82a054f..8ef5b770a 100644 --- a/plugin/rename_file.py +++ b/plugin/rename_file.py @@ -83,16 +83,16 @@ def run( self.rename_path(old_path, new_path) self.notify_did_rename(rename_file_params, new_path, view) return - capability = session.get_capability('workspace.fileOperations.willRename') - if not capability: - return - filters = FileOperationFilterMatcher(capability.get('filters')) - if filters.matches(old_path, view): + filters = (session.get_capability('workspace.fileOperations.willRename') or {}).get('filters') + if filters and FileOperationFilterMatcher(filters).matches(old_path, view): request = Request.willRenameFiles(rename_file_params) session.send_request( request, lambda res: self.handle(res, session.config.name, old_path, new_path, rename_file_params, view) ) + else: + self.rename_path(old_path, new_path) + self.notify_did_rename(rename_file_params, new_path, view) def get_old_path(self, dirs: list[str] | None, files: list[str] | None, view: sublime.View | None) -> str | None: if dirs: @@ -138,10 +138,9 @@ def restore_regions(v: sublime.View | None) -> None: def notify_did_rename(self, rename_file_params: RenameFilesParams, path: str, view: sublime.View | None): for s in self.sessions(): - capability = s.get_capability('workspace.fileOperations.didRename') - if not capability: + filters = (s.get_capability('workspace.fileOperations.didRename') or {}).get('filters') + if not filters: continue - filters = FileOperationFilterMatcher(capability.get('filters')) - if filters.matches(path, view): + if FileOperationFilterMatcher(filters).matches(path, view): s.send_notification(Notification.didRenameFiles(rename_file_params))