Skip to content

Default expected sortText to LocationPriority when verifying completions #1264

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

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions internal/fourslash/_scripts/failingTests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,8 @@ TestCompletionsAfterKeywordsInBlock
TestCompletionsAsserts
TestCompletionsAtIncompleteObjectLiteralProperty
TestCompletionsClassPropertiesAfterPrivateProperty
TestCompletionsConditionalMember
TestCompletionsECMAPrivateMemberTriggerCharacter
TestCompletionsGeneratorFunctions
TestCompletionsGenericIndexedAccess1
TestCompletionsGenericIndexedAccess2
TestCompletionsGenericIndexedAccess6
TestCompletionsImportDefaultExportCrash1
TestCompletionsImport_promoteTypeOnly2
TestCompletionsImport_umdDefaultNoCrash2
Expand All @@ -120,8 +116,6 @@ TestCompletionsNamespaceName
TestCompletionsNewTarget
TestCompletionsNonExistentImport
TestCompletionsObjectLiteralMethod6
TestCompletionsObjectLiteralUnionStringMappingType
TestCompletionsObjectLiteralUnionTemplateLiteralType
TestCompletionsOptionalKindModifier
TestCompletionsOptionalMethod
TestCompletionsOverridingMethod1
Expand All @@ -140,7 +134,6 @@ TestCompletionsPaths_pathMapping
TestCompletionsPaths_pathMapping_nonTrailingWildcard1
TestCompletionsPaths_pathMapping_parentDirectory
TestCompletionsPropertiesPriorities
TestCompletionsPropertiesWithPromiseUnionType
TestCompletionsRecommended_union
TestCompletionsRedeclareModuleAsGlobal
TestCompletionsSelfDeclaring1
Expand All @@ -150,7 +143,6 @@ TestCompletionsSymbolMembers
TestCompletionsTriggerCharacter
TestCompletionsUniqueSymbol1
TestCompletionsWithDeprecatedTag3
TestCompletionsWithOptionalPropertiesGenericPartial3
TestCompletionsWithStringReplacementMode1
TestGetJavaScriptCompletions1
TestGetJavaScriptCompletions10
Expand Down
8 changes: 7 additions & 1 deletion internal/fourslash/fourslash.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,20 @@ func verifyCompletionsAreExactly(t *testing.T, prefix string, actual []*lsproto.
func verifyCompletionItem(t *testing.T, prefix string, actual *lsproto.CompletionItem, expected *lsproto.CompletionItem) {
ignoreKind := cmp.FilterPath(
func(p cmp.Path) bool {
return p.Last().String() == ".Kind"
switch p.Last().String() {
case ".Kind", ".SortText":
return true
default:
return false
}
},
cmp.Ignore(),
)
assertDeepEqual(t, actual, expected, prefix, ignoreKind)
if expected.Kind != nil {
assertDeepEqual(t, actual.Kind, expected.Kind, prefix+" Kind mismatch")
}
assertDeepEqual(t, actual.SortText, core.OrElse(expected.SortText, ptrTo(string(ls.SortTextLocationPriority))), prefix+" SortText mismatch")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

func getExpectedLabel(t *testing.T, item ExpectedCompletionItem) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsConditionalMember(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `declare function f<T extends string>(
p: { a: T extends 'foo' ? { x: string } : { y: string } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsGenericIndexedAccess1(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `interface Sample {
addBook: { name: string, year: number }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsGenericIndexedAccess2(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `export type GetMethodsForType<T, G extends string> = { [K in keyof T]:
T[K] extends () => any ? { name: K, group: G, } : T[K] extends (s: infer U) => any ? { name: K, group: G, payload: U } : never }[keyof T];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsGenericIndexedAccess6(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: component.tsx
interface CustomElements {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsObjectLiteralUnionStringMappingType(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type UnionType = {
key1: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsObjectLiteralUnionTemplateLiteralType(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type UnionType = {
key1: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestCompletionsPropertiesWithPromiseUnionType(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
type MyType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func TestCompletionsWithOptionalPropertiesGenericPartial3(t *testing.T) {
t.Parallel()
t.Skip()

defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
interface Foo {
Expand Down