Skip to content

Commit 8a54935

Browse files
committed
remove unnecessary workaround
fixed at <davidhalter/jedi#1923>
1 parent d4ea5bc commit 8a54935

File tree

4 files changed

+12
-74
lines changed

4 files changed

+12
-74
lines changed

jedi_language_server/jedi_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ def lsp_python_diagnostic(uri: str, source: str) -> Optional[Diagnostic]:
328328
def line_column(position: Position) -> Tuple[int, int]:
329329
"""Translate pygls Position to Jedi's line/column.
330330
331-
Returns a dictionary because this return result should be unpacked as a
332-
function argument to Jedi's functions.
331+
Returns a tuple because this return result should be unpacked as a function
332+
argument to Jedi's functions.
333333
334334
Jedi is 1-indexed for lines and 0-indexed for columns. LSP is 0-indexed for
335335
lines and 0-indexed for columns. Therefore, add 1 to LSP's request for the

jedi_language_server/server.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,21 +371,14 @@ def hover(
371371
jedi_script = jedi_utils.script(server.project, document)
372372
jedi_lines = jedi_utils.line_column(params.position)
373373
markup_kind = _choose_markup(server)
374-
# jedi's help function is buggy when the column is 0. For this reason, as a
375-
# rote fix, we simply set the column to 1 if params.position returns column
376-
# 0.
377374
hover_text = jedi_utils.hover_text(
378-
jedi_script.help(
379-
line=jedi_lines[0],
380-
column=1 if jedi_lines[1] == 0 else jedi_lines[1],
381-
),
375+
jedi_script.help(*jedi_lines),
382376
markup_kind,
383377
server.initialization_options,
384378
)
385379
if not hover_text:
386380
return None
387381
contents = MarkupContent(kind=markup_kind, value=hover_text)
388-
document = server.workspace.get_document(params.text_document.uri)
389382
_range = pygls_utils.current_word_range(document, params.position)
390383
return Hover(contents=contents, range=_range)
391384

0 commit comments

Comments
 (0)