Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds source.fixAll support to the Go TypeScript LSP/LS implementation, along with “fix all missing imports” aggregation and new fourslash conversion/test infrastructure to validate code-fix behavior.
Changes:
- Advertise and implement the
source.fixAllcode action kind in the LSP/LS code action pipeline. - Add a “get all code actions” path for import fixes, coalescing multiple missing-import diagnostics into consolidated edits via
ImportAdder. - Extend the fourslash converter and add generated tests/helpers for
codeFix,codeFixAvailable, andcodeFixAll.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/lsp/server.go | Advertises source.fixAll as a supported code action kind. |
| internal/ls/codeactions.go | Adds source.fixAll handling and kind hierarchy matching helper. |
| internal/ls/codeactions_importfixes.go | Implements GetAllCodeActions for import-related “fix all” aggregation. |
| internal/ls/autoimport/import_adder.go | Extends ImportAdder with AddImportFix to accumulate fixes directly. |
| internal/fourslash/fourslash.go | Adds fourslash helpers for verifying code fixes and “codeFixAll”. |
| internal/fourslash/_scripts/failingTests.txt | Marks additional generated fourslash tests as failing/skipped. |
| internal/fourslash/_scripts/convertFourslash.mts | Ports fourslash parsing/generation for code-fix verification and import handling. |
| internal/fourslash/tests/gen/importNameCodeFix_types_classic_test.go | New generated code-fix-all test coverage (classic module resolution). |
| internal/fourslash/tests/gen/importNameCodeFix_typeOnly2_test.go | New generated code-fix-all test coverage (type-only scenarios). |
| internal/fourslash/tests/gen/importNameCodeFix_require_UMD_test.go | New generated code-fix test coverage for require + UMD. |
| internal/fourslash/tests/gen/importNameCodeFix_require_test.go | New generated code-fix-all test coverage for require imports. |
| internal/fourslash/tests/gen/importNameCodeFix_require_namedAndDefault_test.go | New generated code-fix-all test coverage for named+default require shape. |
| internal/fourslash/tests/gen/importNameCodeFix_require_importVsRequire_moduleTarget_test.go | New generated test coverage for import vs require selection based on module target. |
| internal/fourslash/tests/gen/importNameCodeFix_require_importVsRequire_importWins_test.go | New generated test coverage for import vs require precedence (import wins). |
| internal/fourslash/tests/gen/importNameCodeFix_require_importVsRequire_addToExistingWins_test.go | New generated test coverage for “add to existing” precedence. |
| internal/fourslash/tests/gen/importNameCodeFix_require_addToExisting_test.go | New generated test coverage for updating existing require destructuring. |
| internal/fourslash/tests/gen/importNameCodeFix_jsExtension_test.go | New generated test coverage for .js/.jsx extension module specifiers. |
| internal/fourslash/tests/gen/importNameCodeFix_exportEquals_test.go | New generated test coverage for export = import forms. |
| internal/fourslash/tests/gen/importNameCodeFix_all2_test.go | New generated code-fix-all test coverage (multiple imports). |
| internal/fourslash/tests/gen/importNameCodeFix_all_test.go | New generated broad code-fix-all coverage across many import shapes. |
| internal/fourslash/tests/gen/importNameCodeFix_all_promoteType_test.go | New generated code-fix-all coverage for promote-type-only cases. |
| internal/fourslash/tests/gen/importNameCodeFix_all_js_test.go | New generated code-fix-all coverage in JS + JSDoc import types. |
| internal/fourslash/tests/gen/importNameCodeFix_add_all_missing_imports_test.go | New generated code-fix-all coverage for multiple missing imports. |
| internal/fourslash/tests/gen/codeFixAddMissingImportForReactJsx2_test.go | New generated code-fix-all coverage for react-jsxdev missing imports. |
| internal/fourslash/tests/gen/codeFixAddMissingImportForReactJsx1_test.go | New generated code-fix-all coverage for react-jsx missing imports. |
| internal/fourslash/tests/gen/autoImportTypeOnlyPreferred3_test.go | New generated tests for type-only auto-import preference interactions. |
| internal/fourslash/tests/gen/addAllMissingImportsNoCrash_test.go | New generated regression test ensuring “add all missing imports” doesn’t crash. |
gabritto
approved these changes
Apr 10, 2026
Member
gabritto
left a comment
There was a problem hiding this comment.
Had some questions but this looks good
gabritto
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
source.fixAllsupport. For example, running the "Fix All" command in VS Code nets:This involved porting more fourslash code; mostly code stolen from #3304. But, it required more to also handle imports as we now have a test which breaks the import elision heuristic in the converter. Yay.