Skip to content

Multiple improvements to Quick Info #1184

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

Merged
merged 2 commits into from
Jun 14, 2025
Merged

Multiple improvements to Quick Info #1184

merged 2 commits into from
Jun 14, 2025

Conversation

ahejlsberg
Copy link
Member

Improvements include:

  • Show dotted names for members of classes and interfaces.
  • Show the resolved overload in calls to overloaded functions and methods.
  • Include type arguments in quick info for calls to generic functions and methods.

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 enhances Quick Info by displaying dotted member names, resolving specific overloads for calls, and including type arguments for generic calls.

  • Differentiate type parameters vs arguments in the printer.
  • Adjust hover logic to pass container context, resolve overloads, and show type arguments.
  • Simplify signature-to-node building to inline type parameters and expose resolved signatures.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/printer/printer.go Emit type arguments when a node is not a declaration
internal/ls/hover.go Use getNodeForQuickInfo, getSignaturesAtLocation, and pass container to formatting functions
internal/checker/nodebuilderimpl.go Replace pointer slices with direct slices for type parameters
internal/checker/exports.go Add GetResolvedSignature to the public Checker interface
Comments suppressed due to low confidence (3)

internal/printer/printer.go:1407

  • Consider adding unit tests for emitTypeParameterNode to verify both the type parameter and type argument branches work as intended.
if ast.IsTypeParameterDeclaration(node) {

internal/ls/hover.go:168

  • Add tests covering getNodeForQuickInfo behavior for NewExpression, NamedTupleMember, ImportMeta, and JSXNamespacedName cases to ensure correct node selection.
func getNodeForQuickInfo(node *ast.Node) *ast.Node {

internal/ls/hover.go:199

  • Introduce unit tests for getSignaturesAtLocation to validate overload resolution logic and proper handling of generic signatures with type parameters.
func getSignaturesAtLocation(c *checker.Checker, symbol *ast.Symbol, kind checker.SignatureKind, node *ast.Node) []*checker.Signature {

@ahejlsberg ahejlsberg added this pull request to the merge queue Jun 14, 2025
Merged via the queue into main with commit 792e0c7 Jun 14, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the improve-quick-info-2 branch June 14, 2025 21:11
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