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: 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/" 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 a56416a0..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"'