Skip to content

Commit

Permalink
Make ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
manateelazycat committed Oct 8, 2024
1 parent 9415271 commit 7d10c79
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/handler/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ def process_request(self, position, show_style) -> dict:
return dict(position=position)

def parse_hover_contents(self, contents, render_strings):
content_type = type(contents)
if content_type == str:
if isinstance(contents, str):
if contents.startswith("```"):
render_strings.append(contents)
else:
render_strings.append(make_code_block("text", contents))
elif content_type == dict:
elif isinstance(contents, dict):
if "kind" in contents:
# Some language servers will return plaintext as the kind with the markdown format as value, such as erlang_ls
if contents["kind"] == "markdown" or contents["kind"] == "plaintext":
Expand All @@ -34,7 +33,7 @@ def parse_hover_contents(self, contents, render_strings):
))
elif "language" in contents:
render_strings.append(make_code_block(contents["language"], contents["value"]))
elif content_type == list:
elif isinstance(contents, list):
language = ""
for item in contents:
if isinstance(item, dict):
Expand Down

0 comments on commit 7d10c79

Please sign in to comment.