Skip to content

Commit 54edbea

Browse files
authored
Catch errors when getting docstrings on _resolve_completion (#64)
1 parent 1e48b55 commit 54edbea

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pylsp/plugins/jedi_completion.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,13 @@ def use_snippets(document, position):
165165

166166

167167
def _resolve_completion(completion, d):
168+
# pylint: disable=broad-except
168169
completion['detail'] = _detail(d)
169-
completion['documentation'] = _utils.format_docstring(d.docstring())
170+
try:
171+
docs = _utils.format_docstring(d.docstring())
172+
except Exception:
173+
docs = ''
174+
completion['documentation'] = docs
170175
return completion
171176

172177

test/test_language_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_initialize(client_server): # pylint: disable=redefined-outer-name
8686
assert 'capabilities' in response
8787

8888

89+
@flaky(max_runs=10, min_passes=1)
8990
@pytest.mark.skipif(os.name == 'nt' or (sys.platform.startswith('linux') and PY3),
9091
reason='Skipped on win and fails on linux >=3.6')
9192
def test_exit_with_parent_process_died(client_exited_server): # pylint: disable=redefined-outer-name

0 commit comments

Comments
 (0)