GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Ensure signature help label contains parameter substrings per LSP spec by SoulSniper-V2 · Pull Request #728 · python-lsp/python-lsp-server

Conversation

@SoulSniper-V2

@SoulSniper-V2 SoulSniper-V2 commented Sep 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Problem

When signature help is requested for callable objects whose docstring header does not explicitly list the parameter signature (for example, callable class instances or C-extensions/ufuncs), pylsp could return a truncated label like MyCallable() or ufunc() while parameters lists parameter names like ['a', 'b'] or ['args', 'kwargs'].

According to the LSP 3.17 specification:

Note: a label of type string should be a substring of its containing signature label. Its intended use case is to highlight the parameter label part in the SignatureInformation.label.

Because parameter labels were not substrings of the signature label, strict LSP clients (such as YouCompleteMe) report a protocol error / invalid signature message.

Reported in #678.

Root cause

In pylsp/plugins/signature.py:

  1. function_sig was parsed by splitting s.docstring() on \n\n and taking the first line/paragraph. For callable instances or objects whose docstring begins with a class or type header without parameter names (e.g. ufunc()), this produced a header without parameters.
  2. s.params was populated with parameter objects whose names (p.name) were not contained in the truncated label.

Fix

  1. Use Jedi's s.to_string() to obtain the canonical signature string (e.g. MyCallable(a, b=1)), falling back to docstring parsing if to_string() is empty or unavailable.
  2. If s.params is present and any parameter name is not a substring of function_sig, construct the label as f"{name}({param_list})" so that all parameter names are guaranteed to be substrings of the signature label.
  3. As an additional safeguard, ensure parameter entries in sig["parameters"] are only included if their label is a substring of the containing signature label per the LSP specification.

Test

Added unit tests in test/plugins/test_signature.py:

  • test_callable_instance_signature: Verifies that signature help for a callable class instance includes its parameters in the signature label and that all parameter labels are substrings of the signature label.
  • test_signature_fallback_when_label_missing_params: Verifies fallback formatting when a signature label would otherwise omit parameter names.

Fixes #678

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@SoulSniper-V2
Ensure signature help label contains parameter substrings per LSP spec
b40f38f
Copilot AI lite review requested due to automatic review settings September 26, 2026 23:45
Copilot AI reviewed Sep 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Invalid signature message received from the LSP server

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@SoulSniper-V2
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.