-
Notifications
You must be signed in to change notification settings - Fork 812
Add regression test for inlay hints crash on reparsed nodes #2595
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
Open
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/sub-pr-2593
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.
+51
−1
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
08e244a
Exclude reparsed nodes from inlay hints
ahejlsberg 3b8aadb
Initial plan
Copilot b7c0a22
Add regression test for inlay hints crash on reparsed nodes
Copilot 28b2b1b
Rename test file and function per review feedback
Copilot 64d56f3
Move test from manual/ to gen/ directory
Copilot 4b5d349
Add regression test for inlay hints crash on reparsed nodes
Copilot 787b4bd
Move test to tests/ directory (not gen/ or manual/)
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
31 changes: 31 additions & 0 deletions
31
internal/fourslash/tests/inlayHintsInJavaScriptCjsFile_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,31 @@ | ||
| package fourslash_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/microsoft/typescript-go/internal/fourslash" | ||
| "github.com/microsoft/typescript-go/internal/ls/lsutil" | ||
| "github.com/microsoft/typescript-go/internal/testutil" | ||
| ) | ||
|
|
||
| func TestInlayHintsOnModuleExportsWithFunctionExpression(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| defer testutil.RecoverAndFail(t, "Panic on fourslash test") | ||
| const content = ` | ||
| // @allowJs: true | ||
| // @checkJs: true | ||
|
|
||
| // @Filename: /a.js | ||
| module.exports = function () { | ||
| return 1; | ||
| }; | ||
| ` | ||
|
|
||
| f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content) | ||
| defer done() | ||
| f.VerifyBaselineInlayHints(t, nil /*span*/, &lsutil.UserPreferences{InlayHints: lsutil.InlayHintsPreferences{ | ||
| IncludeInlayFunctionLikeReturnTypeHints: true, | ||
| IncludeInlayFunctionParameterTypeHints: true, | ||
| }}) | ||
| } |
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
19 changes: 19 additions & 0 deletions
19
...s/reference/fourslash/inlayHints/inlayHintsOnModuleExportsWithFunctionExpression.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,19 @@ | ||
| // === Inlay Hints === | ||
| module.exports = function () { | ||
| ^ | ||
| { | ||
| "position": { | ||
| "line": 0, | ||
| "character": 28 | ||
| }, | ||
| "label": [ | ||
| { | ||
| "value": ": " | ||
| }, | ||
| { | ||
| "value": "number" | ||
| } | ||
| ], | ||
| "kind": 1, | ||
| "paddingLeft": true | ||
| } |
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.
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.
@copilot Rename test to
inlayHintsInJavaScriptCjsFile._test.goThere 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.
Also, is this the right directory?
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.
Done in commit 28b2b1b. Renamed test file to
inlayHintsInJavaScriptCjsFile_test.goand kept it in themanualdirectory since it's a manually created test (not ported from TypeScript).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.
Yes, the
manualdirectory is appropriate for this test. Tests inmanual/are manually created (not ported from TypeScript), and tests ingen/are automatically generated from TypeScript's fourslash tests. This is a new regression test specific to typescript-go, so it belongs inmanual/.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.
Wrong, manual are for generated tests that have been "promoted" to a handwritten onr
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.
@copilot obey.
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.
Moved to gen/ directory in commit 64d56f3.
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.
No, they go in
testsdirectlyThere 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.
@copilot try again
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.
Moved to tests/ directory in commit 787b4bd.