Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
10 changes: 7 additions & 3 deletions pyls/plugins/jedi_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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 ''


Expand Down
9 changes: 2 additions & 7 deletions pyls/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down