From 697ebb162804459587f05131fd1a42c45ebfbf05 Mon Sep 17 00:00:00 2001 From: Stephannie Jimenez Gacha Date: Wed, 24 Jul 2019 03:54:20 -0500 Subject: [PATCH] Enable Jedi 0.14.1 (#625) --- pyls/plugins/jedi_completion.py | 5 ++++- setup.py | 2 +- test/plugins/test_completion.py | 4 ++-- test/plugins/test_definitions.py | 2 +- test/plugins/test_symbols.py | 5 +++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pyls/plugins/jedi_completion.py b/pyls/plugins/jedi_completion.py index d2d11cd2..c552e396 100644 --- a/pyls/plugins/jedi_completion.py +++ b/pyls/plugins/jedi_completion.py @@ -89,7 +89,10 @@ def _label(definition): def _detail(definition): - return definition.parent().full_name or '' + try: + return definition.parent().full_name or '' + except AttributeError: + return definition.full_name or '' def _sort_text(definition): diff --git a/setup.py b/setup.py index ac57fdf7..251e1470 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ 'future>=0.14.0', 'futures; python_version<"3.2"', 'backports.functools_lru_cache; python_version<"3.2"', - 'jedi>=0.13.2,<0.14', + 'jedi>=0.13.2,<0.15,!=0.14.0', 'python-jsonrpc-server>=0.1.0', 'pluggy' ], diff --git a/test/plugins/test_completion.py b/test/plugins/test_completion.py index 87a81efd..36094704 100644 --- a/test/plugins/test_completion.py +++ b/test/plugins/test_completion.py @@ -49,7 +49,7 @@ def test_jedi_completion(config): items = pyls_jedi_completions(config, doc, com_position) assert items - assert items[0]['label'] == 'isabs(s)' + assert items[0]['label'] == 'isabs(path)' # Test we don't throw with big character pyls_jedi_completions(config, doc, {'line': 1, 'character': 1000}) @@ -87,7 +87,7 @@ def test_jedi_property_completion(config): items = {c['label']: c['sortText'] for c in completions} # Ensure we can complete the 'world' property - assert 'world' in items + assert 'world' in list(items.keys())[0] def test_jedi_method_completion(config): diff --git a/test/plugins/test_definitions.py b/test/plugins/test_definitions.py index 97408894..e6800fba 100644 --- a/test/plugins/test_definitions.py +++ b/test/plugins/test_definitions.py @@ -39,7 +39,7 @@ def test_builtin_definition(config): # No go-to def for builtins doc = Document(DOC_URI, DOC) - assert [] == pyls_definitions(config, doc, cursor_pos) + assert len(pyls_definitions(config, doc, cursor_pos)) == 1 def test_assignment(config): diff --git a/test/plugins/test_symbols.py b/test/plugins/test_symbols.py index b4bb8b0d..2b6d0c7c 100644 --- a/test/plugins/test_symbols.py +++ b/test/plugins/test_symbols.py @@ -26,8 +26,9 @@ def test_symbols(config): config.update({'plugins': {'jedi_symbols': {'all_scopes': False}}}) symbols = pyls_document_symbols(config, doc) - # All four symbols (import sys, a, B, main, y) - assert len(symbols) == 5 + # All four symbols (import sys, a, B, main) + # y is not in the root scope, it shouldn't be returned + assert len(symbols) == 4 def sym(name): return [s for s in symbols if s['name'] == name][0]