-
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
08e244a
3b8aadb
b7c0a22
28b2b1b
64d56f3
4b5d349
787b4bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 TestInlayHintsCrashReparsed(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, | ||
| }}) | ||
| } | ||
| 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 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- old.inlayHintsCrashReparsed.baseline | ||
| +++ new.inlayHintsCrashReparsed.baseline | ||
|
||
| @@= skipped --1, +0 lines =@@ | ||
| +// === Inlay Hints === | ||
| +module.exports = function () { | ||
| + ^ | ||
| +{ | ||
| + "label": [ | ||
| + { | ||
| + "value": ": " | ||
| + }, | ||
| + { | ||
| + "value": "number" | ||
| + } | ||
| + ], | ||
| + "kind": 1, | ||
| + "paddingLeft": true | ||
| +} | ||
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.
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.