Skip to content

Update imports in unloaded composite projects after file rename#4695

Draft
jakebailey with Copilot wants to merge 2 commits into
mainfrom
copilot/update-imports-after-rename
Draft

Update imports in unloaded composite projects after file rename#4695
jakebailey with Copilot wants to merge 2 commits into
mainfrom
copilot/update-imports-after-rename

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

File renames only updated imports in already-loaded projects. Imports from unopened projects in the same composite project tree were omitted.

Changes

  • Load the full project tree before collecting file-rename edits.
  • Aggregate edits from newly loaded referenced projects.
  • Add regression coverage for an unopened project importing the renamed file:
import { helper } from "../lib/helper";
// becomes
import { helper } from "../lib/renamed-helper";

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix import updates after file rename in composite projects Update imports in unloaded composite projects after file rename Jul 21, 2026
Copilot AI requested a review from jakebailey July 21, 2026 18:12
@jakebailey
jakebailey requested a review from Copilot July 21, 2026 18:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Loads composite project trees before file-rename analysis so unopened dependent projects receive import updates.

Changes:

  • Request full project-tree loading for rename operations.
  • Add fourslash regression coverage.
  • Add a project-state baseline confirming the dependent project loads.

Reviewed changes

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

File Description
internal/project/session.go Loads project trees before creating language services.
internal/fourslash/tests/getEditsForFileRenameWithSolutionConfigFile_test.go Verifies import updates in an unopened project.
testdata/baselines/reference/fourslash/state/getEditsForFileRenameLoadsUnopenedCompositeProject.baseline Records expected project loading state.

ResourceRequest{Documents: uris},
ResourceRequest{
Documents: uris,
ProjectTree: &ProjectTreeRequest{},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, doesn't this request this info for all callers now? Seems like a big hammer but maybe we should always have this info anyway?

I am not familiar enough apparently

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.

Some imports are not updated after a file rename, in composite projects

3 participants