Skip to content

Commit 694ad3b

Browse files
Address PR feedback: Remove unnecessary tests and fix fourslash normalization
- Remove internal/fourslash/tests/gen/locationlink_endtoend_test.go (coverage exists elsewhere) - Remove testdata/tests/cases/compiler/gotoDefinitionLocationLink.ts (not a language service test) - Fix fourslash.go to properly handle DefinitionLinks by setting additionalSpan instead of normalizing to Locations - When single DefinitionLink with origin selection range, use it as additionalSpan for baseline comparison Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
1 parent 5ec5a0b commit 694ad3b

File tree

7 files changed

+12
-192
lines changed

7 files changed

+12
-192
lines changed

internal/fourslash/fourslash.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,24 +886,33 @@ func (f *FourslashTest) VerifyBaselineGoToDefinition(
886886
}
887887

888888
var resultAsLocations []lsproto.Location
889+
var additionalSpan *lsproto.Location
889890
if result.Locations != nil {
890891
resultAsLocations = *result.Locations
891892
} else if result.Location != nil {
892893
resultAsLocations = []lsproto.Location{*result.Location}
893894
} else if result.DefinitionLinks != nil {
894-
// Convert DefinitionLinks to Locations for baseline comparison
895+
// For DefinitionLinks, extract the target locations and optionally set additionalSpan
895896
resultAsLocations = make([]lsproto.Location, len(*result.DefinitionLinks))
896897
for i, link := range *result.DefinitionLinks {
897898
resultAsLocations[i] = lsproto.Location{
898899
Uri: link.TargetUri,
899900
Range: link.TargetSelectionRange,
900901
}
901902
}
903+
// If there's a single result and it has an origin selection range, use it as additionalSpan
904+
if len(*result.DefinitionLinks) == 1 && (*result.DefinitionLinks)[0].OriginSelectionRange != nil {
905+
additionalSpan = &lsproto.Location{
906+
Uri: ls.FileNameToDocumentURI(markerOrRange.GetMarker().FileName()),
907+
Range: *(*result.DefinitionLinks)[0].OriginSelectionRange,
908+
}
909+
}
902910
}
903911

904912
f.baseline.addResult("goToDefinition", f.getBaselineForLocationsWithFileContents(resultAsLocations, baselineFourslashLocationsOptions{
905-
marker: markerOrRange.GetMarker(),
906-
markerName: "/*GO TO DEFINITION*/",
913+
marker: markerOrRange.GetMarker(),
914+
markerName: "/*GO TO DEFINITION*/",
915+
additionalSpan: additionalSpan,
907916
}))
908917
}
909918

internal/fourslash/tests/gen/locationlink_endtoend_test.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

testdata/baselines/reference/compiler/gotoDefinitionLocationLink.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

testdata/baselines/reference/compiler/gotoDefinitionLocationLink.symbols

Lines changed: 0 additions & 42 deletions
This file was deleted.

testdata/baselines/reference/compiler/gotoDefinitionLocationLink.types

Lines changed: 0 additions & 43 deletions
This file was deleted.

testdata/baselines/reference/fourslash/goToDef/LocationLinkEndToEnd.baseline.jsonc

Lines changed: 0 additions & 15 deletions
This file was deleted.

testdata/tests/cases/compiler/gotoDefinitionLocationLink.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)