Skip to content

Conversation

@andrewbranch
Copy link
Member

Fixes #1873
Fixes #1890

Copilot AI review requested due to automatic review settings October 21, 2025 23:21
Copy link
Contributor

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 support for auto-import completion in fourslash tests and fixes several bugs related to import organization, package.json parsing, and module resolution. The changes enable comprehensive testing of auto-import functionality while improving the reliability of import-related features.

Key changes:

  • Added support for auto-import completion verification in fourslash tests
  • Implemented import sorting and organization logic with ESLint-compatible case-insensitive comparison
  • Fixed bugs in package.json dependency checking and module specifier resolution
  • Added extensive fourslash test coverage for auto-import scenarios

Reviewed Changes

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

Show a summary per file
File Description
internal/stringutil/compare.go Added ESLint-compatible case-insensitive string comparison for import sorting
internal/packagejson/packagejson.go Added HasDependency method to check dependencies across all dependency fields
internal/packagejson/cache.go Added Parseable field to track package.json parsing status
internal/modulespecifiers/specifiers.go Fixed logic for handling package.json lookups and module resolution
internal/module/resolver.go Updated to track package.json parse errors
internal/ls/organizeimports.go Implemented comprehensive import sorting and organization utilities
internal/ls/completions.go Refactored completion data structures and fixed symbol-to-origin-info mapping
internal/ls/changetrackerimpl.go Fixed text formatting issues with suffix handling and newline artifacts
internal/ls/changetracker.go Added methods for inserting nodes before others and handling import specifier insertion
internal/ls/autoimportsexportinfo.go Fixed ambient module name comparison by stripping quotes
internal/ls/autoimports.go Improved package.json filtering, changed export info map structure, and added require statement generation
internal/ls/autoimportfixes.go Implemented sorted import insertion and specifier addition
internal/fourslash/tests/gen/*_test.go Added extensive auto-import completion test coverage
testdata/baselines/reference/submodule/compiler/*.diff Updated test baselines showing improved module resolution behavior
Comments suppressed due to low confidence (2)

internal/ls/organizeimports.go:1

  • The function converts strings to lowercase every time, even when the strings are equal. Move the equality check after lowercase conversion to avoid redundant string allocations when strings differ only in case.
package ls

internal/ls/completions.go:1

  • Variable sliceEntryData is assigned twice on consecutive lines (3299 and 3300). The second assignment should be to insertEntryData instead.
package ls

@andrewbranch andrewbranch requested a review from iisaduan October 22, 2025 00:02
@andrewbranch andrewbranch added this pull request to the merge queue Oct 22, 2025
Merged via the queue into microsoft:main with commit 0874642 Oct 22, 2025
22 checks passed
@andrewbranch andrewbranch deleted the auto-import-tests branch October 22, 2025 18:58
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.

Crash getting auto-import completion details in zero-length file Crash in auto-import completions

2 participants