-
Notifications
You must be signed in to change notification settings - Fork 730
Support auto-import completion fourslash tests, fix bugs #1917
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
Conversation
There was a problem hiding this 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
sliceEntryDatais assigned twice on consecutive lines (3299 and 3300). The second assignment should be toinsertEntryDatainstead.
package ls
Fixes #1873
Fixes #1890