-
Notifications
You must be signed in to change notification settings - Fork 661
Port go-to-definition baseline tests #1437
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
Conversation
(or in other words: only omit files if they have no locations and no marker)
There was a problem hiding this 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 pull request ports go-to-definition baseline tests from TypeScript's Strada testing framework to the Go language implementation. The primary purpose is to ensure that go-to-definition functionality works consistently with TypeScript by providing comprehensive test coverage for this critical language service feature.
Key changes include:
- Addition of 173 new generated test files for go-to-definition functionality covering various TypeScript language features
- Addition of 54 new findAllRef baseline test files with updated content that preserves files containing the originating request
- Implementation of
VerifyBaselineGoToDefinition
test method in the fourslash testing framework
Reviewed Changes
Copilot reviewed 299 out of 492 changed files in this pull request and generated no comments.
File | Description |
---|---|
testdata/baselines/reference/fourslash/findAllRef/*.baseline.jsonc | Updated baseline files that now include file headers and preserve originating request files |
internal/fourslash/tests/gen/*_test.go | Generated test files covering comprehensive go-to-definition scenarios including JSX, TypeScript features, and edge cases |
|
||
f.baseline.addResult("goToDefinition", f.getBaselineForLocationsWithFileContents(resultAsLocations, baselineFourslashLocationsOptions{ | ||
marker: markerOrRange.GetMarker(), | ||
markerName: "/*GO TO DEFINITION*/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This marker is different from both of the ones we have in Strada. Open to adopting one over the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code seems fine but I don't know how reasonable it will be to actually review all half a million lines of baselines... Would be interesting to try and diff them or something
A few things that I want to look into tomorrow:
I think that causes more tests to be considered failing than is really necessary. |
|
Yeah, for now, I would say don't really. Just eyeball the accepted baselines at each commit. Knowing what is currently failing will be a little bit helpful though.
I don't know, but I would still like to see if diffing could help later.
Probably something to try later. Right now they're incorrectly converted and skipped. |
Apparently not because it just comes back as a nil slice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and good catch on the trigger locations not being printed if references to the location aren't returned!
Some comments on things mentioned above:
can be translated to ...core.MapNonNil(f.Markers(), func(m *fourslash.Marker) *string {return m.Name}) which will return a slice of all markers in test
I thought about this a lot and tried some different methods of comparing when I was writing the FAR baseline, but besides the different data being returned, other things like whitespace, lines skipped, file and per-marker-result ordering in the baseline weren't the same, so it made an overall string comparison hard.
It would be nice to have better error handling in the LS (and fourslash) in general. The error handling in |
A few noteworthy things:
goToDefinition
andgetDefinitionAtPosition
are slightly distinct in Strada, but we have no such distinction around "bound spans" in LSP that I'm aware of. I'm not sure if this is something "missing" in LSP that we should revisit.