Skip to content

Commit 3630ec9

Browse files
committed
Refactor: Only two types of hover text
Simpify code by implementing only two types of hover text "code" and "markdown". The code text is enclosed in backticks so that it appears as code when displayed by VS Code.
1 parent a363703 commit 3630ec9

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

benten/code/intelligence.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def completion(self):
3636
return [CompletionItem(label=c) for c in self._completions]
3737

3838
def hover(self):
39-
return Hover(self.doc, hover_type=Hover.HoverType.CWLdoc)
39+
return Hover(self.doc, hover_type=Hover.HoverType.Markdown)
4040

4141
def definition(self):
4242
pass

benten/langserver/lspobjects.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,19 @@ class Hover(LSPObject):
240240
class HoverType(IntEnum):
241241
Markdown = 1
242242
Code = 2
243-
CWLdoc = 3
244243

245-
def __init__(self, contents, _range=None, hover_type: HoverType = HoverType.Markdown):
244+
def __init__(self, contents, _range=None,
245+
hover_type: HoverType = HoverType.Markdown):
246246
if hover_type == Hover.HoverType.Code:
247247
self.contents = MarkupContent(
248248
kind="markdown",
249249
value="```\n" + contents + "\n```"
250250
)
251-
elif hover_type == Hover.HoverType.Markdown:
251+
else:
252252
self.contents = MarkupContent(
253253
kind="markdown",
254254
value=contents
255255
)
256-
elif hover_type == Hover.HoverType.CWLdoc:
257-
# For unknown reasons (2020.06) if we pass the CWL docs as a MarkupContent
258-
# object, VS Code fails to render it. Passing as a plain string works fine
259-
self.contents = contents
260256

261257
self.range = _range
262258

0 commit comments

Comments
 (0)