Skip to content

Conversation

ahejlsberg
Copy link
Member

This PR implements the following LSP functionality:

  • Rename command (F2).
  • Find-all-references across module import and export declarations.
  • Find-all-references with contextually typed object literals.
  • Find-all-references with destructuring patterns.

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 implements rename functionality and enhances find-all-references in the TypeScript language server port. The changes primarily focus on adding the LSP rename command (F2) and improving reference finding for module imports/exports, contextually typed object literals, and destructuring patterns.

Key changes:

  • Adds rename command support with proper handling of imports, exports, and property assignments
  • Implements import/export tracking across modules for comprehensive reference finding
  • Enhances object literal and destructuring pattern reference resolution

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/lsp/server.go Adds rename handler registration and LSP capability declaration
internal/ls/findallreferences.go Implements rename logic and import/export reference tracking
internal/ls/importTracker.go New module for tracking imports and exports across files
internal/ls/utilities.go Adds utility functions for object literal elements and node tracking
internal/checker/services.go Enhances property symbol resolution for contextual typing
internal/core/core.go Adds deduplication utility function
testdata/baselines/ Updated test baselines showing improved reference finding

@ahejlsberg
Copy link
Member Author

The inconsistent test failures are due to a race condition in program construction for multi-file tests in fourslash. @andrewbranch is researching.

if searchSym != nil && search.includes(searchSym) {
if rootSymbol != nil && sym.CheckFlags&ast.CheckFlagsSynthetic == 0 {
return rootSymbol, kind
return rootSymbol
Copy link
Member

Choose a reason for hiding this comment

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

What were we using kind for before?

Copy link
Member Author

@ahejlsberg ahejlsberg Aug 27, 2025

Choose a reason for hiding this comment

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

I simply eliminated all the code paths that either (a) ignored kind or (b) passed it through. The Strada code base has some ugly logic that retrofits a RootSymbol type on top of a regular Symbol and distinguishes by checking for a kind property. Since we can't do that in Corsa (good!), the initial port just threaded a kind through everywhere. With these changes it is present only where needed.

@ahejlsberg
Copy link
Member Author

I'm merging this and will work on a separate PR to port over the fourslash tests.

@ahejlsberg ahejlsberg added this pull request to the merge queue Aug 27, 2025
Merged via the queue into main with commit bcb8510 Aug 27, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the rename branch August 27, 2025 19:56
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
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.

5 participants