Skip to content

Add baseline tests from signature help #1485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Jul 31, 2025

This change ports over Strada's baselining signature help tests. There is only one new test failure which has the following problem:

fourslash.go:1040: At position (Ln 0, Col 0): Unexpected response type for signature help request: <nil>

Beyond that, signature help in LSP is surprisingly different in a few ways, and so reconstructing similar visualization is going to be weird. Stuff worth calling out:

  • There is no section for tags. Everything just appears in docs. (expected)

  • We currently don't return any docs! We should do that eventually.

  • There is no notion of an "applicable span" so that the editor can avoid retriggers. Our testing infrastructure used to leverage this.

  • Editors like VS Code bold out the signature help parameter based on the label of the parameter itself. There is a "tuple" version that theoretically avoids a string search, but we don't use the "tuple" version of parameter labels for signature help. This is sketchy for reasons...

    image

    I am currently testing things in a very lazy way where these are indistinguishable. I probably should do it a bit differently.

@Copilot Copilot AI review requested due to automatic review settings July 31, 2025 00:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ports Strada's baselining signature help tests to the LSP implementation. The change introduces comprehensive baseline tests for signature help functionality across various TypeScript and JavaScript scenarios, revealing differences between the old system and LSP signature help behavior. There is one new test failure showing a nil response issue.

Key Changes

  • Ported comprehensive signature help baseline tests from Strada
  • Added 30+ new baseline test files covering various signature help scenarios
  • Tests cover JSDoc tags, overloads, generics, rest parameters, constructors, and more

} else {
t.Fatal("Unsupported param label kind.")
}
signatureLine = strings.Replace(signatureLine, activeParamLabel, "**"+activeParamLabel+"**", 1)
Copy link
Member Author

Choose a reason for hiding this comment

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

This should really only be done if we don't come back with the tuple representation.

if activeParam.Label.String != nil {
activeParamLabel = *activeParam.Label.String
} else if activeParam.Label.Tuple != nil {
activeParamLabel = signatureLine[(*activeParam.Label.Tuple)[0]:(*activeParam.Label.Tuple)[1]]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is slightly wrong because these are supposed to be UTF-16 offsets. But it's not really "testable' today because we don't even come back with this data.

Copy link
Member

Choose a reason for hiding this comment

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

You could utf16.Encode + slice + utf16.Decode

@DanielRosenwasser
Copy link
Member Author

The stuff I need to do to get signature offsets is absolutely gross, so I would like to get a review once I fix the conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants