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

Conversation

Andarist
Copy link
Contributor

No description provided.

@Copilot Copilot AI review requested due to automatic review settings June 22, 2025 22:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the fourslash tests so that they now verify that the expected completion item's sortText defaults to LocationPriority when not provided. In addition, the t.Skip() calls have been removed from several test files to allow these tests to run.

  • Removed t.Skip() calls in multiple fourslash test files.
  • Added an assertion in fourslash.go to verify that SortText falls back to LocationPriority.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/fourslash/tests/gen/completionsWithOptionalPropertiesGenericPartial3_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsPropertiesWithPromiseUnionType_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsObjectLiteralUnionTemplateLiteralType_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsObjectLiteralUnionStringMappingType_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsGenericIndexedAccess6_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsGenericIndexedAccess2_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsGenericIndexedAccess1_test.go Removed t.Skip() to run the test
internal/fourslash/tests/gen/completionsConditionalMember_test.go Removed t.Skip() to run the test
internal/fourslash/fourslash.go Added assertion for SortText default check

},
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.

@gabritto
Copy link
Member

I wonder if instead of doing this, it wouldn't be better to just have the conversion script add the default sort text explicitly when it's missing in the original Strada tests.

@Andarist
Copy link
Contributor Author

@gabritto I considered this but figured out it will be annoying to include this explicitly in all tests once u start adding new tests manually to Corsa. If you prefer that though - let me know, I can certainly switch this PR to do that instead

@gabritto
Copy link
Member

Yeah, I think defaulting to something is more convenient for writing the tests, but might be more confusing for reading them.

I've been trying to make the fourslash behavior more consistent in terms of which properties we ignore, which we default etc, but I think that's impossible, sadly.
So we might as well make it more convenient to write these tests in the common case.

@jakebailey jakebailey added this pull request to the merge queue Jun 23, 2025
Merged via the queue into microsoft:main with commit a8d79ee Jun 23, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants