Skip to content

Commit 9a48038

Browse files
authored
Consistently name VS types with prefix VS (#4173)
1 parent fe932f6 commit 9a48038

15 files changed

Lines changed: 164 additions & 164 deletions

internal/fourslash/fourslash.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ func (f *FourslashTest) VerifyBaselineFindAllReferences(
23342334
}
23352335
}
23362336

2337-
func (f *FourslashTest) VerifyBaselineVsFindAllReferences(
2337+
func (f *FourslashTest) VerifyBaselineVSFindAllReferences(
23382338
t *testing.T,
23392339
markers ...string,
23402340
) {
@@ -2354,9 +2354,9 @@ func (f *FourslashTest) VerifyBaselineVsFindAllReferences(
23542354
}
23552355
result := sendRequest(t, f, lsproto.TextDocumentVSReferencesInfo, params)
23562356
// Sort cross-project results for deterministic baselines
2357-
if result.VsReferenceItems != nil && len(*result.VsReferenceItems) > 0 {
2358-
items := *result.VsReferenceItems
2359-
slices.SortStableFunc(items, func(a, b *lsproto.VsReferenceItem) int {
2357+
if result.VSReferenceItems != nil && len(*result.VSReferenceItems) > 0 {
2358+
items := *result.VSReferenceItems
2359+
slices.SortStableFunc(items, func(a, b *lsproto.VSReferenceItem) int {
23602360
ap, bp := "", ""
23612361
if a.VSProjectName != nil {
23622362
ap = *a.VSProjectName
@@ -2396,8 +2396,8 @@ func (f *FourslashTest) VerifyBaselineVsFindAllReferences(
23962396
}
23972397
// Include file contents with markers
23982398
var locations []lsproto.Location
2399-
if result.VsReferenceItems != nil {
2400-
for _, item := range *result.VsReferenceItems {
2399+
if result.VSReferenceItems != nil {
2400+
for _, item := range *result.VSReferenceItems {
24012401
locations = append(locations, item.VSLocation)
24022402
}
24032403
}
@@ -3960,7 +3960,7 @@ func (f *FourslashTest) VerifyQuickInfoIs(t *testing.T, expectedText string, exp
39603960
func (f *FourslashTest) VerifyJsxClosingTag(t *testing.T, markersToNewText map[string]*string) {
39613961
for marker, expectedText := range markersToNewText {
39623962
f.GoToMarker(t, marker)
3963-
params := &lsproto.VsOnAutoInsertParams{
3963+
params := &lsproto.VSOnAutoInsertParams{
39643964
VSTextDocument: lsproto.TextDocumentIdentifier{
39653965
Uri: lsconv.FileNameToDocumentURI(f.activeFilename),
39663966
},
@@ -3971,7 +3971,7 @@ func (f *FourslashTest) VerifyJsxClosingTag(t *testing.T, markersToNewText map[s
39713971
requestResult := sendRequest(t, f, lsproto.TextDocumentVSOnAutoInsertInfo, params)
39723972

39733973
var actualText *string
3974-
if item := requestResult.VsOnAutoInsertResponseItem; item != nil && item.VSTextEdit != nil {
3974+
if item := requestResult.VSOnAutoInsertResponseItem; item != nil && item.VSTextEdit != nil {
39753975
newText := item.VSTextEdit.NewText
39763976
if item.VSTextEditFormat == lsproto.InsertTextFormatSnippet {
39773977
var ok bool
@@ -3990,12 +3990,12 @@ func (f *FourslashTest) VerifyJsxClosingTag(t *testing.T, markersToNewText map[s
39903990
func (f *FourslashTest) VerifyBaselineClosingTags(t *testing.T) {
39913991
t.Helper()
39923992

3993-
markersAndItems := core.MapFiltered(f.Markers(), func(marker *Marker) (markerAndItem[*lsproto.VsOnAutoInsertResponseItem], bool) {
3993+
markersAndItems := core.MapFiltered(f.Markers(), func(marker *Marker) (markerAndItem[*lsproto.VSOnAutoInsertResponseItem], bool) {
39943994
if marker.Name == nil {
3995-
return markerAndItem[*lsproto.VsOnAutoInsertResponseItem]{}, false
3995+
return markerAndItem[*lsproto.VSOnAutoInsertResponseItem]{}, false
39963996
}
39973997

3998-
params := &lsproto.VsOnAutoInsertParams{
3998+
params := &lsproto.VSOnAutoInsertParams{
39993999
VSTextDocument: lsproto.TextDocumentIdentifier{
40004000
Uri: lsconv.FileNameToDocumentURI(marker.FileName()),
40014001
},
@@ -4004,17 +4004,17 @@ func (f *FourslashTest) VerifyBaselineClosingTags(t *testing.T) {
40044004
}
40054005

40064006
result := sendRequest(t, f, lsproto.TextDocumentVSOnAutoInsertInfo, params)
4007-
return markerAndItem[*lsproto.VsOnAutoInsertResponseItem]{Marker: marker, Item: result.VsOnAutoInsertResponseItem}, true
4007+
return markerAndItem[*lsproto.VSOnAutoInsertResponseItem]{Marker: marker, Item: result.VSOnAutoInsertResponseItem}, true
40084008
})
40094009

4010-
getRange := func(item *lsproto.VsOnAutoInsertResponseItem) *lsproto.Range {
4010+
getRange := func(item *lsproto.VSOnAutoInsertResponseItem) *lsproto.Range {
40114011
// Returning nil lets annotateContentWithTooltips render the caret marker at
40124012
// the marker position. The text edit's range is zero-width at the cursor,
40134013
// which would render as an empty underline.
40144014
return nil
40154015
}
40164016

4017-
getTooltipLines := func(item, _prev *lsproto.VsOnAutoInsertResponseItem) []string {
4017+
getTooltipLines := func(item, _prev *lsproto.VSOnAutoInsertResponseItem) []string {
40184018
if item == nil || item.VSTextEdit == nil {
40194019
return []string{"No closing tag"}
40204020
}

internal/fourslash/tests/constructorFindAllReferences1VS_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ func TestConstructorFindAllReferences1VS(t *testing.T) {
1919
new C().foo();`
2020
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
2121
defer done()
22-
f.VerifyBaselineVsFindAllReferences(t, "")
22+
f.VerifyBaselineVSFindAllReferences(t, "")
2323
}

internal/fourslash/tests/findAllRefsForDefaultExportVS_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ import /*deg*/g from "./a";
2020
import { f } from "./a";`
2121
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
2222
defer done()
23-
f.VerifyBaselineVsFindAllReferences(t, "def", "deg")
23+
f.VerifyBaselineVSFindAllReferences(t, "def", "deg")
2424
}

internal/fourslash/tests/findAllRefsInheritedProperties1VS_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ v./*3*/doStuff();
2121
v./*4*/propName;`
2222
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
2323
defer done()
24-
f.VerifyBaselineVsFindAllReferences(t, "1", "2", "3", "4")
24+
f.VerifyBaselineVSFindAllReferences(t, "1", "2", "3", "4")
2525
}

internal/fourslash/tests/findReferencesAcrossMultipleProjectsVS_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ func TestFindReferencesAcrossMultipleProjectsVS(t *testing.T) {
2121
/*4*/x++;`
2222
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
2323
defer done()
24-
f.VerifyBaselineVsFindAllReferences(t, "1", "2", "3", "4")
24+
f.VerifyBaselineVSFindAllReferences(t, "1", "2", "3", "4")
2525
}

internal/fourslash/tests/tsxFindAllReferences1VS_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ declare namespace JSX {
2525
var x = /*2*/</*3*/div />;`
2626
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
2727
defer done()
28-
f.VerifyBaselineVsFindAllReferences(t, "1", "2", "3")
28+
f.VerifyBaselineVSFindAllReferences(t, "1", "2", "3")
2929
}

internal/ls/autoinsert.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import (
99
"github.com/microsoft/typescript-go/internal/scanner"
1010
)
1111

12-
func (l *LanguageService) ProvideOnAutoInsert(ctx context.Context, params *lsproto.VsOnAutoInsertParams) (lsproto.VsOnAutoInsertResponse, error) {
12+
func (l *LanguageService) ProvideOnAutoInsert(ctx context.Context, params *lsproto.VSOnAutoInsertParams) (lsproto.VSOnAutoInsertResponse, error) {
1313
if params.VSCh != ">" {
14-
return lsproto.VsOnAutoInsertResponse{}, nil
14+
return lsproto.VSOnAutoInsertResponse{}, nil
1515
}
1616

1717
_, sourceFile := l.getProgramAndFile(params.VSTextDocument.Uri)
1818
position := l.converters.LineAndCharacterToPosition(sourceFile, params.VSPosition)
1919

2020
token := astnav.FindPrecedingToken(sourceFile, int(position))
2121
if token == nil {
22-
return lsproto.VsOnAutoInsertResponse{}, nil
22+
return lsproto.VSOnAutoInsertResponse{}, nil
2323
}
2424

2525
var closingText string
@@ -48,11 +48,11 @@ func (l *LanguageService) ProvideOnAutoInsert(ctx context.Context, params *lspro
4848
}
4949

5050
if closingText == "" {
51-
return lsproto.VsOnAutoInsertResponse{}, nil
51+
return lsproto.VSOnAutoInsertResponse{}, nil
5252
}
5353

54-
return lsproto.VsOnAutoInsertResponse{
55-
VsOnAutoInsertResponseItem: &lsproto.VsOnAutoInsertResponseItem{
54+
return lsproto.VSOnAutoInsertResponse{
55+
VSOnAutoInsertResponseItem: &lsproto.VSOnAutoInsertResponseItem{
5656
VSTextEditFormat: lsproto.InsertTextFormatSnippet,
5757
VSTextEdit: &lsproto.TextEdit{
5858
Range: lsproto.Range{Start: params.VSPosition, End: params.VSPosition},

internal/ls/crossproject.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,17 @@ func combineReferences(results iter.Seq[lsproto.ReferencesResponse]) lsproto.Ref
308308
return lsproto.LocationsOrNull{Locations: combineResponseLocations(results)}
309309
}
310310

311-
func combineVsReferences(results iter.Seq[lsproto.VsReferencesResponse]) lsproto.VsReferencesResponse {
312-
var combined []*lsproto.VsReferenceItem
311+
func combineVSReferences(results iter.Seq[lsproto.VSReferencesResponse]) lsproto.VSReferencesResponse {
312+
var combined []*lsproto.VSReferenceItem
313313
// Re-number IDs across projects to maintain unique IDs and correct definition references
314314
nextId := int32(0)
315315
for resp := range results {
316-
if resp.VsReferenceItems == nil {
316+
if resp.VSReferenceItems == nil {
317317
continue
318318
}
319319
// Map old IDs to new IDs for this batch
320320
idMap := make(map[int32]int32)
321-
for _, item := range *resp.VsReferenceItems {
321+
for _, item := range *resp.VSReferenceItems {
322322
oldId := item.VSId
323323
newId := nextId
324324
idMap[oldId] = newId
@@ -333,7 +333,7 @@ func combineVsReferences(results iter.Seq[lsproto.VsReferencesResponse]) lsproto
333333
combined = append(combined, &newItem)
334334
}
335335
}
336-
return lsproto.VsReferencesResponse{VsReferenceItems: &combined}
336+
return lsproto.VSReferencesResponse{VSReferenceItems: &combined}
337337
}
338338

339339
func combineImplementations(results iter.Seq[lsproto.ImplementationResponse]) lsproto.ImplementationResponse {

internal/ls/displaypartswriter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var _ printer.EmitTextWriter = &displayPartsWriter{}
1818
// When vsCapability is false, only the plain string is built; runs are skipped.
1919
type displayPartsWriter struct {
2020
builder strings.Builder
21-
runs []*lsproto.ClassifiedTextRun
21+
runs []*lsproto.VSClassifiedTextRun
2222
vsCapability bool
2323
lastWritten string
2424
}
@@ -32,7 +32,7 @@ func (w *displayPartsWriter) addRun(classification lsproto.ClassificationTypeNam
3232
return
3333
}
3434
if w.vsCapability {
35-
w.runs = append(w.runs, &lsproto.ClassifiedTextRun{
35+
w.runs = append(w.runs, &lsproto.VSClassifiedTextRun{
3636
ClassificationTypeName: string(classification),
3737
Text: text,
3838
})
@@ -57,7 +57,7 @@ func (w *displayPartsWriter) WriteFrom(other *displayPartsWriter) {
5757
}
5858
}
5959

60-
func (w *displayPartsWriter) GetRuns() []*lsproto.ClassifiedTextRun {
60+
func (w *displayPartsWriter) GetRuns() []*lsproto.VSClassifiedTextRun {
6161
return w.runs
6262
}
6363

internal/ls/findallreferences.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,14 @@ func (l *LanguageService) ProvideReferences(ctx context.Context, params *lsproto
669669
)
670670
}
671671

672-
func (l *LanguageService) ProvideVsReferences(ctx context.Context, params *lsproto.ReferenceParams, orchestrator CrossProjectOrchestrator) (lsproto.VsReferencesResponse, error) {
672+
func (l *LanguageService) ProvideVSReferences(ctx context.Context, params *lsproto.ReferenceParams, orchestrator CrossProjectOrchestrator) (lsproto.VSReferencesResponse, error) {
673673
return handleCrossProject(
674674
l,
675675
ctx,
676676
params,
677677
orchestrator,
678-
(*LanguageService).symbolAndEntriesToVsReferences,
679-
combineVsReferences,
678+
(*LanguageService).symbolAndEntriesToVSReferences,
679+
combineVSReferences,
680680
false, /*isRename*/
681681
false, /*implementations*/
682682
symbolEntryTransformOptions{},
@@ -691,10 +691,10 @@ func (l *LanguageService) symbolAndEntriesToReferences(ctx context.Context, para
691691
return lsproto.LocationsOrNull{Locations: &locations}, nil
692692
}
693693

694-
func (l *LanguageService) symbolAndEntriesToVsReferences(ctx context.Context, params *lsproto.ReferenceParams, data SymbolAndEntriesData, options symbolEntryTransformOptions) (lsproto.VsReferencesResponse, error) {
694+
func (l *LanguageService) symbolAndEntriesToVSReferences(ctx context.Context, params *lsproto.ReferenceParams, data SymbolAndEntriesData, options symbolEntryTransformOptions) (lsproto.VSReferencesResponse, error) {
695695
caps := lsproto.GetClientCapabilities(ctx)
696696
vsCapability := caps.VSSupportsVisualStudioExtensions
697-
var items []*lsproto.VsReferenceItem
697+
var items []*lsproto.VSReferenceItem
698698
id := int32(0)
699699
projectName := string(l.projectPath)
700700

@@ -712,11 +712,11 @@ func (l *LanguageService) symbolAndEntriesToVsReferences(ctx context.Context, pa
712712
// Create the definition item
713713
definitionId := id
714714
emptyStr := ""
715-
defItem := &lsproto.VsReferenceItem{
715+
defItem := &lsproto.VSReferenceItem{
716716
VSId: definitionId,
717717
VSLocation: defInfo.location,
718718
VSDefinitionText: defInfo.displayText,
719-
VSKind: &[]lsproto.VsReferenceKind{lsproto.VsReferenceKindUnknown},
719+
VSKind: &[]lsproto.VSReferenceKind{lsproto.VSReferenceKindUnknown},
720720
VSProjectName: &projectName,
721721
VSContainingType: &emptyStr,
722722
}
@@ -733,31 +733,31 @@ func (l *LanguageService) symbolAndEntriesToVsReferences(ctx context.Context, pa
733733
refLocation := l.getLocationOfEntry(ref)
734734

735735
// Determine read/write kind
736-
kind := lsproto.VsReferenceKindRead
736+
kind := lsproto.VSReferenceKindRead
737737
if ref.kind != entryKindRange && ref.node != nil && ast.IsWriteAccessForReference(ref.node) {
738-
kind = lsproto.VsReferenceKindWrite
738+
kind = lsproto.VSReferenceKindWrite
739739
}
740740

741-
refItem := &lsproto.VsReferenceItem{
741+
refItem := &lsproto.VSReferenceItem{
742742
VSId: id,
743743
VSDefinitionId: &definitionId,
744744
VSLocation: refLocation,
745-
VSKind: &[]lsproto.VsReferenceKind{kind},
745+
VSKind: &[]lsproto.VSReferenceKind{kind},
746746
VSProjectName: &projectName,
747747
}
748748
items = append(items, refItem)
749749
id++
750750
}
751751
}
752752

753-
return lsproto.VsReferencesResponse{VsReferenceItems: &items}, nil
753+
return lsproto.VSReferencesResponse{VSReferenceItems: &items}, nil
754754
}
755755

756756
// referencedSymbolDefinitionInfo holds the computed info for a definition
757757
type referencedSymbolDefinitionInfo struct {
758758
node *ast.Node
759759
location lsproto.Location
760-
displayText *lsproto.ClassifiedTextElement
760+
displayText *lsproto.VSClassifiedTextElement
761761
}
762762

763763
// definitionToReferencedSymbolDefinitionInfo converts a Definition to display info
@@ -796,8 +796,8 @@ func (l *LanguageService) definitionToReferencedSymbolDefinitionInfo(ctx context
796796
return &referencedSymbolDefinitionInfo{
797797
node: node,
798798
location: loc,
799-
displayText: &lsproto.ClassifiedTextElement{
800-
Runs: []*lsproto.ClassifiedTextRun{{Text: node.Text(), ClassificationTypeName: string(lsproto.ClassificationTypeNameText)}},
799+
displayText: &lsproto.VSClassifiedTextElement{
800+
Runs: []*lsproto.VSClassifiedTextRun{{Text: node.Text(), ClassificationTypeName: string(lsproto.ClassificationTypeNameText)}},
801801
},
802802
}
803803

@@ -811,8 +811,8 @@ func (l *LanguageService) definitionToReferencedSymbolDefinitionInfo(ctx context
811811
return &referencedSymbolDefinitionInfo{
812812
node: node,
813813
location: loc,
814-
displayText: &lsproto.ClassifiedTextElement{
815-
Runs: []*lsproto.ClassifiedTextRun{{Text: name, ClassificationTypeName: string(lsproto.ClassificationTypeNameKeyword)}},
814+
displayText: &lsproto.VSClassifiedTextElement{
815+
Runs: []*lsproto.VSClassifiedTextRun{{Text: name, ClassificationTypeName: string(lsproto.ClassificationTypeNameKeyword)}},
816816
},
817817
}
818818

@@ -842,8 +842,8 @@ func (l *LanguageService) definitionToReferencedSymbolDefinitionInfo(ctx context
842842
return &referencedSymbolDefinitionInfo{
843843
node: node,
844844
location: loc,
845-
displayText: &lsproto.ClassifiedTextElement{
846-
Runs: []*lsproto.ClassifiedTextRun{{Text: node.Text(), ClassificationTypeName: string(lsproto.ClassificationTypeNameString)}},
845+
displayText: &lsproto.VSClassifiedTextElement{
846+
Runs: []*lsproto.VSClassifiedTextRun{{Text: node.Text(), ClassificationTypeName: string(lsproto.ClassificationTypeNameString)}},
847847
},
848848
}
849849

@@ -856,8 +856,8 @@ func (l *LanguageService) definitionToReferencedSymbolDefinitionInfo(ctx context
856856
return &referencedSymbolDefinitionInfo{
857857
node: node,
858858
location: loc,
859-
displayText: &lsproto.ClassifiedTextElement{
860-
Runs: []*lsproto.ClassifiedTextRun{{Text: `"` + def.tripleSlashFileRef.reference.FileName + `"`, ClassificationTypeName: string(lsproto.ClassificationTypeNameString)}},
859+
displayText: &lsproto.VSClassifiedTextElement{
860+
Runs: []*lsproto.VSClassifiedTextRun{{Text: `"` + def.tripleSlashFileRef.reference.FileName + `"`, ClassificationTypeName: string(lsproto.ClassificationTypeNameString)}},
861861
},
862862
}
863863

@@ -867,7 +867,7 @@ func (l *LanguageService) definitionToReferencedSymbolDefinitionInfo(ctx context
867867
}
868868

869869
// getDefinitionKindAndDisplayParts returns the classified display text for a symbol definition.
870-
func (l *LanguageService) getDefinitionKindAndDisplayParts(ctx context.Context, symbol *ast.Symbol, originalNode *ast.Node, vsCapability bool) *lsproto.ClassifiedTextElement {
870+
func (l *LanguageService) getDefinitionKindAndDisplayParts(ctx context.Context, symbol *ast.Symbol, originalNode *ast.Node, vsCapability bool) *lsproto.VSClassifiedTextElement {
871871
program := l.GetProgram()
872872
c, done := program.GetTypeChecker(ctx)
873873
defer done()
@@ -877,12 +877,12 @@ func (l *LanguageService) getDefinitionKindAndDisplayParts(ctx context.Context,
877877
info := getQuickInfoAndDeclarationAtLocation(c, symbol, originalNode, nil, vsCapability, meaning)
878878

879879
if vsCapability {
880-
return &lsproto.ClassifiedTextElement{Runs: info.displayParts.GetRuns()}
880+
return &lsproto.VSClassifiedTextElement{Runs: info.displayParts.GetRuns()}
881881
}
882882
// Fallback: single unclassified run with the full text
883883
text := info.displayParts.String()
884-
return &lsproto.ClassifiedTextElement{
885-
Runs: []*lsproto.ClassifiedTextRun{{Text: text, ClassificationTypeName: string(lsproto.ClassificationTypeNameText)}},
884+
return &lsproto.VSClassifiedTextElement{
885+
Runs: []*lsproto.VSClassifiedTextRun{{Text: text, ClassificationTypeName: string(lsproto.ClassificationTypeNameText)}},
886886
}
887887
}
888888

0 commit comments

Comments
 (0)