Skip to content

Commit 6a26eeb

Browse files
committed
Fix opt-out, add a test
1 parent 011882d commit 6a26eeb

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pylsp/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def format_signature(signature: str, config: dict, signature_formatter: str) ->
285285

286286

287287
def convert_signatures_to_markdown(signatures: List[str], config: dict) -> str:
288-
signature_formatter = config.get("format", "black")
288+
signature_formatter = config.get("formatter", "black")
289289
if signature_formatter:
290290
signatures = [
291291
format_signature(

test/plugins/test_hover.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ def test_hover_signature_formatting(workspace) -> None:
106106
assert {"contents": contents} == pylsp_hover(doc._config, doc, hov_position)
107107

108108

109+
def test_hover_signature_formatting_opt_out(workspace) -> None:
110+
# Over 'main' in def main():
111+
hov_position = {"line": 2, "character": 6}
112+
113+
doc = Document(DOC_URI, workspace, DOC)
114+
doc._config.update({"signature": {"line_length": 10, "formatter": None}})
115+
116+
contents = {
117+
"kind": "markdown",
118+
"value": "```python\nmain(a: float, b: float)\n```\n\n\nhello world",
119+
}
120+
121+
assert {"contents": contents} == pylsp_hover(doc._config, doc, hov_position)
122+
109123
def test_document_path_hover(workspace_other_root_path, tmpdir) -> None:
110124
# Create a dummy module out of the workspace's root_path and try to get
111125
# a definition on it in another file placed next to it.

0 commit comments

Comments
 (0)