package fourslash_test import ( "testing" "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash" . "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util" "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil" ) func TestStringLiteralCompletionsInJsxAttributeInitializer(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @jsx: preserve // @filename: /a.tsx type Props = { a: number } | { b: "somethingelse", c: 0 | 1 }; declare function Foo(args: Props): any const a1 = const a2 = const a3 = const a4 = const a5 = ` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyCompletions(t, []string{"1", "2"}, &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ CommitCharacters: &DefaultCommitCharacters, EditRange: Ignored, }, Items: &fourslash.CompletionsExpectedItems{ Exact: []fourslash.CompletionsExpectedItem{ "somethingelse", }, }, }) f.VerifyCompletions(t, []string{"3", "4"}, &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ CommitCharacters: &DefaultCommitCharacters, EditRange: Ignored, }, Items: &fourslash.CompletionsExpectedItems{ Excludes: []string{ "\"somethingelse\"", }, }, }) f.VerifyCompletions(t, []string{"5"}, &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ CommitCharacters: &DefaultCommitCharacters, EditRange: Ignored, }, Items: &fourslash.CompletionsExpectedItems{ Excludes: []string{ "0", "1", }, }, }) }