From f8b42d179eb62d149ec8c4f6979a581c938ecd6d Mon Sep 17 00:00:00 2001 From: Richard Kellnberger Date: Sat, 3 Jun 2023 18:49:31 +0200 Subject: [PATCH] Allow multiple hover results --- pylsp/hookspecs.py | 2 +- pylsp/python_lsp.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pylsp/hookspecs.py b/pylsp/hookspecs.py index d1a2458e..39343e80 100644 --- a/pylsp/hookspecs.py +++ b/pylsp/hookspecs.py @@ -89,7 +89,7 @@ def pylsp_format_range(config, workspace, document, range, options): pass -@hookspec(firstresult=True) +@hookspec def pylsp_hover(config, workspace, document, position): pass diff --git a/pylsp/python_lsp.py b/pylsp/python_lsp.py index 43f886cc..d35f42f2 100644 --- a/pylsp/python_lsp.py +++ b/pylsp/python_lsp.py @@ -369,7 +369,10 @@ def highlight(self, doc_uri, position): return flatten(self._hook('pylsp_document_highlight', doc_uri, position=position)) or None def hover(self, doc_uri, position): - return self._hook('pylsp_hover', doc_uri, position=position) or {'contents': ''} + out = self._hook('pylsp_hover', doc_uri, position=position) + if out: + return {'contents': [o['contents'] for o in out]} + return {'contents': ''} @_utils.debounce(LINT_DEBOUNCE_S, keyed_by='doc_uri') def lint(self, doc_uri, is_saved):