Skip to content

Commit 171cecd

Browse files
Copilotjakebailey
andcommitted
Revert incorrect commit character change; make test 21 manual
Reverts the change in computeCommitCharactersAndIsNewIdentifier that incorrectly switched TupleType and IndexSignature to emptyCommitCharacters. The original TypeScript code uses allCommitCharacters for all four kinds (ArrayLiteralExpression, IndexSignature, TupleType, ComputedPropertyName). The test expectation mismatch was caused by the Go test generator mapping isNewIdentifierLocation:true to empty commit characters, which is incorrect for this context. Made test 21 manual with the correct DefaultCommitCharacters. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
1 parent 460b995 commit 171cecd

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

internal/fourslash/_scripts/manualTests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ completionImportModuleSpecifierEndingTsxPreserve
2121
completionImportModuleSpecifierEndingTsxReact
2222
completionListInClosedFunction05
2323
completionListInImportClause05
24+
completionListInTypeLiteralInTypeParameter21
2425
completionListWithLabel
2526
completionsAtIncompleteObjectLiteralProperty
2627
completionsImport_defaultAndNamedConflict

internal/fourslash/tests/gen/completionListInTypeLiteralInTypeParameter21_test.go renamed to internal/fourslash/tests/manual/completionListInTypeLiteralInTypeParameter21_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func TestCompletionListInTypeLiteralInTypeParameter21(t *testing.T) {
12-
fourslash.SkipIfFailing(t)
12+
1313
t.Parallel()
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `class Foo<T extends ('one' | 2)[]> {}
@@ -25,7 +25,7 @@ Foo<[/*4*/]>;`
2525
f.VerifyCompletions(t, "0", &fourslash.CompletionsExpectedList{
2626
IsIncomplete: false,
2727
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
28-
CommitCharacters: &[]string{},
28+
CommitCharacters: &DefaultCommitCharacters,
2929
EditRange: Ignored,
3030
},
3131
Items: &fourslash.CompletionsExpectedItems{
@@ -38,7 +38,7 @@ Foo<[/*4*/]>;`
3838
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
3939
IsIncomplete: false,
4040
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
41-
CommitCharacters: &[]string{},
41+
CommitCharacters: &DefaultCommitCharacters,
4242
EditRange: Ignored,
4343
},
4444
Items: &fourslash.CompletionsExpectedItems{
@@ -51,7 +51,7 @@ Foo<[/*4*/]>;`
5151
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
5252
IsIncomplete: false,
5353
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
54-
CommitCharacters: &[]string{},
54+
CommitCharacters: &DefaultCommitCharacters,
5555
EditRange: Ignored,
5656
},
5757
Items: &fourslash.CompletionsExpectedItems{
@@ -64,7 +64,7 @@ Foo<[/*4*/]>;`
6464
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
6565
IsIncomplete: false,
6666
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
67-
CommitCharacters: &[]string{},
67+
CommitCharacters: &DefaultCommitCharacters,
6868
EditRange: Ignored,
6969
},
7070
Items: &fourslash.CompletionsExpectedItems{
@@ -77,7 +77,7 @@ Foo<[/*4*/]>;`
7777
f.VerifyCompletions(t, "4", &fourslash.CompletionsExpectedList{
7878
IsIncomplete: false,
7979
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
80-
CommitCharacters: &[]string{},
80+
CommitCharacters: &DefaultCommitCharacters,
8181
EditRange: Ignored,
8282
},
8383
Items: &fourslash.CompletionsExpectedItems{

internal/ls/completions.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,13 +3492,11 @@ func computeCommitCharactersAndIsNewIdentifier(
34923492
case ast.KindOpenBracketToken:
34933493
switch containingNodeKind {
34943494
// [ |
3495-
case ast.KindArrayLiteralExpression, ast.KindComputedPropertyName:
3496-
return true, allCommitCharacters
34973495
// [ | : string ]
34983496
// [ | : string ]
34993497
// [ | /* this can become an index signature */
3500-
case ast.KindIndexSignature, ast.KindTupleType:
3501-
return true, emptyCommitCharacters
3498+
case ast.KindArrayLiteralExpression, ast.KindIndexSignature, ast.KindTupleType, ast.KindComputedPropertyName:
3499+
return true, allCommitCharacters
35023500
default:
35033501
return false, allCommitCharacters
35043502
}

0 commit comments

Comments
 (0)