-
Notifications
You must be signed in to change notification settings - Fork 881
Fix signature help assertion failure by marking all DeepCloneReparse descendants as reparsed #3252
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
Draft
Copilot
wants to merge
4
commits into
main
Choose a base branch
from
copilot/fix-signature-help-assertion-failure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−2
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6f3648c
Initial plan
Copilot 1c94fda
Fix signature help assertion failure by replacing hard assert with gr…
Copilot 5132cb6
Fix signature help assertion failure by marking all DeepCloneReparse …
Copilot 8fdb10d
Refactor setParentAndReparsedInChildren to pass parent explicitly
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
internal/fourslash/tests/signatureHelpJSDocReparsed_test.go
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package fourslash_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/microsoft/typescript-go/internal/fourslash" | ||
| "github.com/microsoft/typescript-go/internal/testutil" | ||
| ) | ||
|
|
||
| func TestSignatureHelpJSDocReparsed(t *testing.T) { | ||
| t.Parallel() | ||
| defer testutil.RecoverAndFail(t, "Panic on fourslash test") | ||
| const content = `// @allowJs: true | ||
| // @checkJs: true | ||
| // @Filename: test.js | ||
| /** | ||
| * @param {string} x | ||
| */ | ||
| function foo(x) { | ||
| foo(/*1*/); | ||
| } | ||
| /** | ||
| * @this {string} | ||
| */ | ||
| function bar() { | ||
| bar(/*2*/); | ||
| } | ||
| /** | ||
| * @type {function(string): void} | ||
| */ | ||
| function qux(x) { | ||
| qux(/*3*/); | ||
| } | ||
| /** | ||
| * @template T | ||
| * @param {T} x | ||
| * @returns {T} | ||
| */ | ||
| function identity(x) { | ||
| identity(/*4*/); | ||
| } | ||
| ` | ||
| f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) | ||
| defer done() | ||
| f.VerifyBaselineSignatureHelp(t) | ||
| } |
142 changes: 142 additions & 0 deletions
142
testdata/baselines/reference/fourslash/signatureHelp/signatureHelpJSDocReparsed.baseline
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // === SignatureHelp === | ||
| === /test.js === | ||
| // /** | ||
| // * @param {string} x | ||
| // */ | ||
| // function foo(x) { | ||
| // foo(); | ||
| // ^ | ||
| // | ---------------------------------------------------------------------- | ||
| // | foo(**x: string**): void | ||
| // | ---------------------------------------------------------------------- | ||
| // } | ||
| // /** | ||
| // * @this {string} | ||
| // */ | ||
| // function bar() { | ||
| // bar(); | ||
| // ^ | ||
| // | ---------------------------------------------------------------------- | ||
| // | bar(): void | ||
| // | ---------------------------------------------------------------------- | ||
| // } | ||
| // /** | ||
| // * @type {function(string): void} | ||
| // */ | ||
| // function qux(x) { | ||
| // qux(); | ||
| // ^ | ||
| // | ---------------------------------------------------------------------- | ||
| // | qux(**x: any**): void | ||
| // | ---------------------------------------------------------------------- | ||
| // } | ||
| // /** | ||
| // * @template T | ||
| // * @param {T} x | ||
| // * @returns {T} | ||
| // */ | ||
| // function identity(x) { | ||
| // identity(); | ||
| // ^ | ||
| // | ---------------------------------------------------------------------- | ||
| // | identity(**x: unknown**): unknown | ||
| // | ---------------------------------------------------------------------- | ||
| // } | ||
| // | ||
| [ | ||
| { | ||
| "marker": { | ||
| "Position": 55, | ||
| "LSPosition": { | ||
| "line": 4, | ||
| "character": 8 | ||
| }, | ||
| "Name": "1", | ||
| "Data": {} | ||
| }, | ||
| "item": { | ||
| "signatures": [ | ||
| { | ||
| "label": "foo(x: string): void", | ||
| "parameters": [ | ||
| { | ||
| "label": "x: string" | ||
| } | ||
| ], | ||
| "activeParameter": 0 | ||
| } | ||
| ], | ||
| "activeSignature": 0 | ||
| } | ||
| }, | ||
| { | ||
| "marker": { | ||
| "Position": 111, | ||
| "LSPosition": { | ||
| "line": 10, | ||
| "character": 8 | ||
| }, | ||
| "Name": "2", | ||
| "Data": {} | ||
| }, | ||
| "item": { | ||
| "signatures": [ | ||
| { | ||
| "label": "bar(): void", | ||
| "parameters": [] | ||
| } | ||
| ], | ||
| "activeSignature": 0 | ||
| } | ||
| }, | ||
| { | ||
| "marker": { | ||
| "Position": 184, | ||
| "LSPosition": { | ||
| "line": 16, | ||
| "character": 8 | ||
| }, | ||
| "Name": "3", | ||
| "Data": {} | ||
| }, | ||
| "item": { | ||
| "signatures": [ | ||
| { | ||
| "label": "qux(x: any): void", | ||
| "parameters": [ | ||
| { | ||
| "label": "x: any" | ||
| } | ||
| ], | ||
| "activeParameter": 0 | ||
| } | ||
| ], | ||
| "activeSignature": 0 | ||
| } | ||
| }, | ||
| { | ||
| "marker": { | ||
| "Position": 280, | ||
| "LSPosition": { | ||
| "line": 24, | ||
| "character": 13 | ||
| }, | ||
| "Name": "4", | ||
| "Data": {} | ||
| }, | ||
| "item": { | ||
| "signatures": [ | ||
| { | ||
| "label": "identity(x: unknown): unknown", | ||
| "parameters": [ | ||
| { | ||
| "label": "x: unknown" | ||
| } | ||
| ], | ||
| "activeParameter": 0 | ||
| } | ||
| ], | ||
| "activeSignature": 0 | ||
| } | ||
| } | ||
| ] |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Using closures for this is slow/allocate-y, which is why the above code for the normal SetParentInChildren is so goofy. If this fix is right, we should make it work like SetParentInChildren