From 77e9be541159752b91ff6e35bdc268ac484fa666 Mon Sep 17 00:00:00 2001 From: 95833 <987004590@qq.com> Date: Sun, 22 Dec 2024 19:59:18 +0800 Subject: [PATCH] Update types.py --- plugin/core/types.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugin/core/types.py b/plugin/core/types.py index deb8e2368..e05e46b4c 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -853,6 +853,15 @@ def match_view(self, view: sublime.View, scheme: str) -> bool: if not selector: return False return scheme in self.schemes and sublime.score_selector(syntax.scope, selector) > 0 + + def map_client_path_to_server_uri(self, path: str) -> str: + return self.map_uri_on_payload(filename_to_uri(path), is_from_client_to_server=True) + + def map_server_uri_to_client_path(self, uri: str) -> str: + scheme, path = parse_uri(self.map_uri_on_payload(uri, is_from_client_to_server=False)) + if scheme not in ("file", "res"): + raise ValueError(f"{uri}: {scheme} URI scheme is unsupported") + return path def map_uri_on_payload(self, payload: Any, is_from_client_to_server: bool) -> Any: if isinstance(payload, dict): @@ -872,15 +881,6 @@ def map_uri_on_payload(self, payload: Any, is_from_client_to_server: bool) -> An return payload - def map_client_path_to_server_uri(self, path: str) -> str: - return self.map_uri_on_payload(filename_to_uri(path), is_from_client_to_server=True) - - def map_server_uri_to_client_path(self, uri: str) -> str: - scheme, path = parse_uri(self.map_uri_on_payload(uri, is_from_client_to_server=False)) - if scheme not in ("file", "res"): - raise ValueError(f"{uri}: {scheme} URI scheme is unsupported") - return path - def is_disabled_capability(self, capability_path: str) -> bool: for value in self.disabled_capabilities.walk(capability_path): if isinstance(value, bool):