Skip to content

Commit

Permalink
[WIP] Prepare compat
Browse files Browse the repository at this point in the history
  • Loading branch information
cfroehli committed Jan 29, 2021
1 parent 14e96bc commit e8bda04
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions jedi-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -714,15 +714,15 @@ See: https://github.com/tkf/emacs-jedi/issues/54"
(substring-no-properties (or (buffer-file-name) "")))

(defun jedi:call-deferred (method-name)
"Call ``Script(...).METHOD-NAME`` and return a deferred object."
"Call ``Script(...).METHOD-NAME(...)`` and return a deferred object."
(let ((source (buffer-substring-no-properties (point-min) (point-max)))
(source-path (jedi:-buffer-file-name))
;; line=0 is an error for jedi, but is possible for empty buffers.
(line (max 1 (count-lines (point-min) (min (1+ (point)) (point-max)))))
(column (- (point) (line-beginning-position)))
(source-path (jedi:-buffer-file-name)))
(column (- (point) (line-beginning-position))))
(epc:call-deferred (jedi:get-epc)
method-name
(list source line column source-path))))
(list source source-path line column))))


;;; Completion
Expand Down
8 changes: 4 additions & 4 deletions jediepcserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ def _wrap_completion_result(comp):
description=candidates_description(comp),
symbol=candidate_symbol(comp),
)
source, line, column, source_path = args
source, source_path, line, column = args
return [
_wrap_completion_result(comp)
for comp in self.jedi_script(source, source_path).complete(line, column)
]

def get_in_function_call(self, *args):
source, line, column, source_path = args
source, source_path, line, column = args
sig = self.jedi_script(source, source_path).get_signatures(line, column)
call_def = sig[0] if sig else None

Expand All @@ -251,7 +251,7 @@ def _goto(self, method, *args):
# `definitions` is a list. Each element is an instances of
# `jedi.api_classes.BaseOutput` subclass, i.e.,
# `jedi.api_classes.RelatedName` or `jedi.api_classes.Definition`.
source, line, column, source_path = args
source, source_path, line, column = args
definitions = method(self.jedi_script(source, source_path), line, column)
return [dict(
column=d.column,
Expand All @@ -268,7 +268,7 @@ def related_names(self, *args):
return self._goto(jedi.Script.get_references, *args)

def get_definition(self, *args):
source, line, column, source_path = args
source, source_path, line, column = args
definitions = self.jedi_script(source, source_path).infer(line, column)
return [definition_to_dict(d) for d in definitions]

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
version='0.3.0',
py_modules=['jediepcserver'],
install_requires=[
"jedi>=0.18.0",
"jedi>=0.18.0;python_version>3.5",
"jedi<0.18.0;python_version<=3.5",
"epc>=0.0.4",
"argparse",
],
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[tox]
envlist = py36, py37, py38, py39
envlist = py27, py35, py36, py37, py38, py39

[testenv]
deps =
pytest
jedi>=0.18.0
jedi>=0.18.0;python_version>3.5
jedi<0.18.0;python_version<=3.5
commands = py.test {posargs} test_jediepcserver.py

[pytest]
Expand Down

0 comments on commit e8bda04

Please sign in to comment.