feat(2280): Port implement interface quick fix#3499
Open
a-tarasyuk wants to merge 11 commits intomicrosoft:mainfrom
Open
feat(2280): Port implement interface quick fix#3499a-tarasyuk wants to merge 11 commits intomicrosoft:mainfrom
a-tarasyuk wants to merge 11 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Ports/implements the “Implement interface” quick fix to address #2280, along with supporting infrastructure changes and updated baselines.
Changes:
- Added a new code fix provider to implement missing interface/class members and supporting member generation utilities.
- Extended the change tracker to support inserting members at the start of class/interface/object bodies with correct formatting.
- Updated fourslash conversion/runtime to support range-based expected content and user preference overrides; refreshed relevant baselines.
Reviewed changes
Copilot reviewed 116 out of 120 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/ls/codeactions_fixclassincorrectlyimplementsinterface.go |
New code fix provider wiring + fix-all implementation for “Implement interface”. |
internal/ls/codeactions_missingmemberfixer.go |
Core logic to synthesize missing members (methods/properties/accessors/index signatures) + auto-import support. |
internal/ls/change/tracker.go |
Adds “insert-at-start” behavior and formatting adjustments to support new code fix output. |
internal/fourslash/fourslash.go |
Extends code-fix verification to support range replacement and per-test user preferences. |
internal/fourslash/_scripts/convertFourslash.mts |
Updates generator to allow the new fixId/prefix and emit new verification options. |
internal/checker/* + internal/printer/* + internal/scanner/scanner.go |
Exposes helper APIs needed by the new code fix and adjusts error range behavior for class expressions. |
testdata/* |
Baseline/acceptance list updates reflecting changed diagnostics ranges and comment placement. |
Comments suppressed due to low confidence (5)
internal/ls/codeactions_missingmemberfixer.go:1
for i := range argCountdoes not compile in Go (you can’t range over anint). Replace this with an index loop such asfor i := 0; i < argCount; i++ { ... }so the new code fix builds.
internal/ls/codeactions_missingmemberfixer.go:1- This
paniccan crash the language server on malformed/partial ASTs (which is common while typing). Prefer returning no node / skipping this accessor (or surfacing a normal error) instead of panicking, so code actions remain robust.
internal/fourslash/tests/gen/quickfixImplementInterfaceUnreachableTypeUsesRelativeImport_test.go:1 NewFileContentis empty, so the test will compare the post-edit content to""and fail (unless the code fix somehow produces an empty file). PopulateNewFileContentwith the expected full file text after the fix, or useNewRangeContentif only a specific range should be asserted.
internal/transformers/tstransforms/typeserializer.go:1- This helper was changed from unexported to exported, but (in this diff) it’s only used within this package/file and duplicates the new exported
checker.GetSetAccessorValueParameter. Consider keeping it unexported (or adding a clear GoDoc and centralizing on thecheckerhelper) to avoid unintentionally expanding the public surface area and creating duplicate APIs.
internal/printer/utilities.go:1 - This function is now exported but has no GoDoc comment. If this repo runs golint/staticcheck-style checks, this will be flagged; even if not, adding a short comment explaining the contract (e.g., whether it counts comments/trivia) will make the new API clearer.
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.
Fixes #2280