diff --git a/plugin.py b/plugin.py index 85ae670..266df3b 100644 --- a/plugin.py +++ b/plugin.py @@ -7,7 +7,6 @@ import sublime from LSP.plugin import ClientConfig, DottedDict, Response, WorkspaceFolder -from LSP.plugin.core.protocol import CompletionItem, Hover, SignatureHelp from LSP.plugin.core.typing import Any, Callable, List, Optional, Tuple, cast from lsp_utils import NpmClientHandler from sublime_lib import ResourcePath @@ -90,20 +89,17 @@ def markdown_language_id_to_st_syntax_map(cls) -> Optional["MarkdownLangMap"]: def on_server_response_async(self, method: str, response: Response) -> None: if method == "textDocument/hover" and isinstance(response.result, dict): - hover = cast(Hover, response.result) - contents = hover.get("contents") + contents = response.result.get("contents") if isinstance(contents, dict) and contents.get("kind") == "markdown": contents["value"] = self.patch_markdown_content(contents["value"]) return if method == "completionItem/resolve" and isinstance(response.result, dict): - completion = cast(CompletionItem, response.result) - documentation = completion.get("documentation") + documentation = response.result.get("documentation") if isinstance(documentation, dict) and documentation.get("kind") == "markdown": documentation["value"] = self.patch_markdown_content(documentation["value"]) return if method == "textDocument/signatureHelp" and isinstance(response.result, dict): - signature_help = cast(SignatureHelp, response.result) - for signature in signature_help["signatures"]: + for signature in response.result["signatures"]: documentation = signature.get("documentation") if isinstance(documentation, dict) and documentation.get("kind") == "markdown": documentation["value"] = self.patch_markdown_content(documentation["value"])