Skip to content

Commit a8d79ee

Browse files
authored
Default expected sortText to LocationPriority when verifying completions (#1264)
1 parent b7ca2d3 commit a8d79ee

10 files changed

+15
-17
lines changed

internal/fourslash/_scripts/failingTests.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,8 @@ TestCompletionsAfterKeywordsInBlock
9696
TestCompletionsAsserts
9797
TestCompletionsAtIncompleteObjectLiteralProperty
9898
TestCompletionsClassPropertiesAfterPrivateProperty
99-
TestCompletionsConditionalMember
10099
TestCompletionsECMAPrivateMemberTriggerCharacter
101100
TestCompletionsGeneratorFunctions
102-
TestCompletionsGenericIndexedAccess1
103-
TestCompletionsGenericIndexedAccess2
104-
TestCompletionsGenericIndexedAccess6
105101
TestCompletionsImportDefaultExportCrash1
106102
TestCompletionsImport_promoteTypeOnly2
107103
TestCompletionsImport_umdDefaultNoCrash2
@@ -119,8 +115,6 @@ TestCompletionsNamespaceName
119115
TestCompletionsNewTarget
120116
TestCompletionsNonExistentImport
121117
TestCompletionsObjectLiteralMethod6
122-
TestCompletionsObjectLiteralUnionStringMappingType
123-
TestCompletionsObjectLiteralUnionTemplateLiteralType
124118
TestCompletionsOptionalKindModifier
125119
TestCompletionsOptionalMethod
126120
TestCompletionsOverridingMethod1
@@ -139,7 +133,6 @@ TestCompletionsPaths_pathMapping
139133
TestCompletionsPaths_pathMapping_nonTrailingWildcard1
140134
TestCompletionsPaths_pathMapping_parentDirectory
141135
TestCompletionsPropertiesPriorities
142-
TestCompletionsPropertiesWithPromiseUnionType
143136
TestCompletionsRecommended_union
144137
TestCompletionsRedeclareModuleAsGlobal
145138
TestCompletionsSelfDeclaring1
@@ -149,7 +142,6 @@ TestCompletionsSymbolMembers
149142
TestCompletionsTriggerCharacter
150143
TestCompletionsUniqueSymbol1
151144
TestCompletionsWithDeprecatedTag3
152-
TestCompletionsWithOptionalPropertiesGenericPartial3
153145
TestCompletionsWithStringReplacementMode1
154146
TestGetJavaScriptCompletions1
155147
TestGetJavaScriptCompletions10

internal/fourslash/fourslash.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,20 @@ func verifyCompletionsAreExactly(t *testing.T, prefix string, actual []*lsproto.
466466
func verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) {
467467
ignoreKind := cmp.FilterPath(
468468
func(p cmp.Path) bool {
469-
return p.Last().String() == ".Kind"
469+
switch p.Last().String() {
470+
case ".Kind", ".SortText":
471+
return true
472+
default:
473+
return false
474+
}
470475
},
471476
cmp.Ignore(),
472477
)
473478
assertDeepEqual(t, actual, expected, prefix, ignoreKind)
474479
if expected.Kind != nil {
475480
assertDeepEqual(t, actual.Kind, expected.Kind, prefix+" Kind mismatch")
476481
}
482+
assertDeepEqual(t, actual.SortText, core.OrElse(expected.SortText, ptrTo(string(ls.SortTextLocationPriority))), prefix+" SortText mismatch")
477483
}
478484

479485
func getExpectedLabel(t *testing.T, item ExpectedCompletionItem) string {

internal/fourslash/tests/gen/completionsConditionalMember_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsConditionalMember(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `declare function f<T extends string>(
1616
p: { a: T extends 'foo' ? { x: string } : { y: string } }

internal/fourslash/tests/gen/completionsGenericIndexedAccess1_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsGenericIndexedAccess1(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `interface Sample {
1616
addBook: { name: string, year: number }

internal/fourslash/tests/gen/completionsGenericIndexedAccess2_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsGenericIndexedAccess2(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `export type GetMethodsForType<T, G extends string> = { [K in keyof T]:
1616
T[K] extends () => any ? { name: K, group: G, } : T[K] extends (s: infer U) => any ? { name: K, group: G, payload: U } : never }[keyof T];

internal/fourslash/tests/gen/completionsGenericIndexedAccess6_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsGenericIndexedAccess6(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `// @Filename: component.tsx
1616
interface CustomElements {

internal/fourslash/tests/gen/completionsObjectLiteralUnionStringMappingType_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsObjectLiteralUnionStringMappingType(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `type UnionType = {
1616
key1: string;

internal/fourslash/tests/gen/completionsObjectLiteralUnionTemplateLiteralType_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsObjectLiteralUnionTemplateLiteralType(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `type UnionType = {
1616
key1: string;

internal/fourslash/tests/gen/completionsPropertiesWithPromiseUnionType_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
func TestCompletionsPropertiesWithPromiseUnionType(t *testing.T) {
1212
t.Parallel()
13-
t.Skip()
13+
1414
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1515
const content = `// @strict: true
1616
type MyType = {

internal/fourslash/tests/gen/completionsWithOptionalPropertiesGenericPartial3_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func TestCompletionsWithOptionalPropertiesGenericPartial3(t *testing.T) {
1313
t.Parallel()
14-
t.Skip()
14+
1515
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
1616
const content = `// @strict: true
1717
interface Foo {

0 commit comments

Comments
 (0)