From b673d6f4524bfb541e475d4c8bb2b5ce8fe97d3b Mon Sep 17 00:00:00 2001 From: dalthviz Date: Sat, 4 Apr 2020 14:42:34 -0500 Subject: [PATCH 1/4] Update requirements to use Jedi 0.16 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a56416a0..ce55d143 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ 'configparser; python_version<"3.0"', 'future>=0.14.0; python_version<"3"', 'backports.functools_lru_cache; python_version<"3.2"', - 'jedi>=0.14.1,<0.16', + 'jedi>=0.14.1,<=0.16', 'python-jsonrpc-server>=0.3.2', 'pluggy', 'ujson<=1.35; platform_system!="Windows"' From 04779a8dd16ba609fe0b6710aeae90687900a3b3 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Sat, 4 Apr 2020 15:15:12 -0500 Subject: [PATCH 2/4] Try CI with Jedi master branch --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7ec7b8a3..fd72071c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ jobs: steps: - checkout - run: pip install -e .[all] .[test] + - run: pip install -q --no-deps git+https://github.com/davidhalter/jedi - run: py.test -v test/ - run: pylint pyls test - run: pycodestyle pyls test @@ -21,6 +22,7 @@ jobs: - run: python3 -m venv /tmp/pyenv - run: /tmp/pyenv/bin/python -m pip install loghub - run: pip install -e .[all] .[test] + - run: pip install -q --no-deps git+https://github.com/davidhalter/jedi - run: py.test -v test/ lint: From d0a5a0585708ad2bc0dddee9e5c42dcf2ed55411 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Sat, 4 Apr 2020 15:22:34 -0500 Subject: [PATCH 3/4] Try Jedi master in AppVeyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 69e3e858..7ced096b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,7 @@ init: install: - "%PYTHON%/python.exe -m pip install --upgrade pip setuptools" - "%PYTHON%/python.exe -m pip install .[all] .[test]" + - "%PYTHON%/python.exe -m pip install -q --no-deps git+https://github.com/davidhalter/jedi" test_script: - "%PYTHON%/Scripts/pytest.exe -v test/" From 928265b13db37446a35e91bd45e8721ac67039bc Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Sun, 29 Mar 2020 21:36:08 +0200 Subject: [PATCH 4/4] Changed towards jedi 0.16 Signed-off-by: Morten Linderud --- pyls/plugins/jedi_completion.py | 10 +++++++--- pyls/workspace.py | 9 ++------- setup.py | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pyls/plugins/jedi_completion.py b/pyls/plugins/jedi_completion.py index caa543a1..9106c3c1 100644 --- a/pyls/plugins/jedi_completion.py +++ b/pyls/plugins/jedi_completion.py @@ -51,7 +51,11 @@ @hookimpl def pyls_completions(config, document, position): try: - definitions = document.jedi_script(position).completions() + code_position = {} + if position: + code_position = {'line': position['line'] + 1, + 'column': _utils.clip_column(position['character'], document.lines, position['line'])} + definitions = document.jedi_script().complete(**code_position) except AttributeError as e: if 'CompiledObject' in str(e): # Needed to handle missing CompiledObject attribute @@ -69,7 +73,7 @@ def pyls_completions(config, document, position): settings = config.plugin_settings('jedi_completion', document_path=document.path) should_include_params = settings.get('include_params') include_params = snippet_support and should_include_params and use_snippets(document, position) - return [_format_completion(d, include_params) for d in definitions] or None + return [_format_completion(signature, include_params) for d in definitions for signature in d.get_signatures()] or None def is_exception_class(name): @@ -173,7 +177,7 @@ def _label(definition): def _detail(definition): try: return definition.parent().full_name or '' - except AttributeError: + except (AttributeError, TypeError): return definition.full_name or '' diff --git a/pyls/workspace.py b/pyls/workspace.py index a58b76a2..f5c72375 100644 --- a/pyls/workspace.py +++ b/pyls/workspace.py @@ -237,16 +237,11 @@ def jedi_script(self, position=None): environment = self.get_enviroment(environment_path) if environment_path else None kwargs = { - 'source': self.source, - 'path': self.path, - 'sys_path': sys_path, + 'code': self.source, 'environment': environment, + 'project': jedi.api.Project(self.path, sys_path=sys_path), } - if position: - kwargs['line'] = position['line'] + 1 - kwargs['column'] = _utils.clip_column(position['character'], self.lines, position['line']) - return jedi.Script(**kwargs) def get_enviroment(self, environment_path=None): diff --git a/setup.py b/setup.py index ce55d143..8120f91a 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ 'configparser; python_version<"3.0"', 'future>=0.14.0; python_version<"3"', 'backports.functools_lru_cache; python_version<"3.2"', - 'jedi>=0.14.1,<=0.16', + 'jedi>=0.14.1', 'python-jsonrpc-server>=0.3.2', 'pluggy', 'ujson<=1.35; platform_system!="Windows"'