Skip to content

Commit 11a9b3f

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/server: fix event labels after the big rename
The old names predate the big directory renaming we did about a year ago. For the record: why can't these event.Start calls be emitted by the generated server handler code? Two reasons: 1) they sometimes have arguments specific to the call; and 2) they cover only the handler proper, but not the time to send the RPC reply message. Had they been automatically generated in the caller, some care would be required to exclude the RPC reply time. Change-Id: I290537579200aab162ac06522a482b4f4e4f7a28 Reviewed-on: https://go-review.googlesource.com/c/tools/+/663135 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]> Auto-Submit: Alan Donovan <[email protected]>
1 parent 3e7f74d commit 11a9b3f

25 files changed

+42
-42
lines changed

gopls/internal/server/call_hierarchy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
func (s *server) PrepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
17-
ctx, done := event.Start(ctx, "lsp.Server.prepareCallHierarchy")
17+
ctx, done := event.Start(ctx, "server.PrepareCallHierarchy")
1818
defer done()
1919

2020
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)
@@ -29,7 +29,7 @@ func (s *server) PrepareCallHierarchy(ctx context.Context, params *protocol.Call
2929
}
3030

3131
func (s *server) IncomingCalls(ctx context.Context, params *protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
32-
ctx, done := event.Start(ctx, "lsp.Server.incomingCalls")
32+
ctx, done := event.Start(ctx, "server.IncomingCalls")
3333
defer done()
3434

3535
fh, snapshot, release, err := s.fileOf(ctx, params.Item.URI)
@@ -44,7 +44,7 @@ func (s *server) IncomingCalls(ctx context.Context, params *protocol.CallHierarc
4444
}
4545

4646
func (s *server) OutgoingCalls(ctx context.Context, params *protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
47-
ctx, done := event.Start(ctx, "lsp.Server.outgoingCalls")
47+
ctx, done := event.Start(ctx, "server.OutgoingCalls")
4848
defer done()
4949

5050
fh, snapshot, release, err := s.fileOf(ctx, params.Item.URI)

gopls/internal/server/code_action.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
func (s *server) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error) {
25-
ctx, done := event.Start(ctx, "lsp.Server.codeAction")
25+
ctx, done := event.Start(ctx, "server.CodeAction")
2626
defer done()
2727

2828
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)
@@ -225,7 +225,7 @@ func triggerKind(params *protocol.CodeActionParams) protocol.CodeActionTriggerKi
225225
// This feature allows capable clients to preview and selectively apply the diff
226226
// instead of applying the whole thing unconditionally through workspace/applyEdit.
227227
func (s *server) ResolveCodeAction(ctx context.Context, ca *protocol.CodeAction) (*protocol.CodeAction, error) {
228-
ctx, done := event.Start(ctx, "lsp.Server.resolveCodeAction")
228+
ctx, done := event.Start(ctx, "server.ResolveCodeAction")
229229
defer done()
230230

231231
// Only resolve the code action if there is Data provided.

gopls/internal/server/code_lens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
// CodeLens reports the set of available CodeLenses
2323
// (range-associated commands) in the given file.
2424
func (s *server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
25-
ctx, done := event.Start(ctx, "lsp.Server.codeLens", label.URI.Of(params.TextDocument.URI))
25+
ctx, done := event.Start(ctx, "server.CodeLens", label.URI.Of(params.TextDocument.URI))
2626
defer done()
2727

2828
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)

gopls/internal/server/command.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import (
4747
)
4848

4949
func (s *server) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (any, error) {
50-
ctx, done := event.Start(ctx, "lsp.Server.executeCommand")
50+
ctx, done := event.Start(ctx, "server.ExecuteCommand")
5151
defer done()
5252

5353
// For test synchronization, always create a progress notification.
@@ -1652,7 +1652,7 @@ func (c *commandHandler) DiagnoseFiles(ctx context.Context, args command.Diagnos
16521652
// Though note that implementing pull diagnostics may cause some servers to
16531653
// request diagnostics in an ad-hoc manner, and break our intentional pacing.
16541654

1655-
ctx, done := event.Start(ctx, "lsp.server.DiagnoseFiles")
1655+
ctx, done := event.Start(ctx, "commandHandler.DiagnoseFiles")
16561656
defer done()
16571657

16581658
snapshots := make(map[*cache.Snapshot]bool)

gopls/internal/server/completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (s *server) Completion(ctx context.Context, params *protocol.CompletionPara
2727
recordLatency(ctx, rerr)
2828
}()
2929

30-
ctx, done := event.Start(ctx, "lsp.Server.completion", label.URI.Of(params.TextDocument.URI))
30+
ctx, done := event.Start(ctx, "server.Completion", label.URI.Of(params.TextDocument.URI))
3131
defer done()
3232

3333
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)

gopls/internal/server/definition.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (s *server) Definition(ctx context.Context, params *protocol.DefinitionPara
2424
recordLatency(ctx, rerr)
2525
}()
2626

27-
ctx, done := event.Start(ctx, "lsp.Server.definition", label.URI.Of(params.TextDocument.URI))
27+
ctx, done := event.Start(ctx, "server.Definition", label.URI.Of(params.TextDocument.URI))
2828
defer done()
2929

3030
// TODO(rfindley): definition requests should be multiplexed across all views.
@@ -46,7 +46,7 @@ func (s *server) Definition(ctx context.Context, params *protocol.DefinitionPara
4646
}
4747

4848
func (s *server) TypeDefinition(ctx context.Context, params *protocol.TypeDefinitionParams) ([]protocol.Location, error) {
49-
ctx, done := event.Start(ctx, "lsp.Server.typeDefinition", label.URI.Of(params.TextDocument.URI))
49+
ctx, done := event.Start(ctx, "server.TypeDefinition", label.URI.Of(params.TextDocument.URI))
5050
defer done()
5151

5252
// TODO(rfindley): type definition requests should be multiplexed across all views.

gopls/internal/server/diagnostics.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (s *server) diagnoseChangedViews(ctx context.Context, modID uint64, lastCha
200200
// snapshot (or a subsequent snapshot in the same View) is eventually
201201
// diagnosed.
202202
func (s *server) diagnoseSnapshot(ctx context.Context, snapshot *cache.Snapshot, changedURIs []protocol.DocumentURI, delay time.Duration) {
203-
ctx, done := event.Start(ctx, "Server.diagnoseSnapshot", snapshot.Labels()...)
203+
ctx, done := event.Start(ctx, "server.diagnoseSnapshot", snapshot.Labels()...)
204204
defer done()
205205

206206
if delay > 0 {
@@ -241,7 +241,7 @@ func (s *server) diagnoseSnapshot(ctx context.Context, snapshot *cache.Snapshot,
241241
}
242242

243243
func (s *server) diagnoseChangedFiles(ctx context.Context, snapshot *cache.Snapshot, uris []protocol.DocumentURI) (diagMap, error) {
244-
ctx, done := event.Start(ctx, "Server.diagnoseChangedFiles", snapshot.Labels()...)
244+
ctx, done := event.Start(ctx, "server.diagnoseChangedFiles", snapshot.Labels()...)
245245
defer done()
246246

247247
toDiagnose := make(map[metadata.PackageID]*metadata.Package)
@@ -311,7 +311,7 @@ func (s *server) diagnoseChangedFiles(ctx context.Context, snapshot *cache.Snaps
311311
}
312312

313313
func (s *server) diagnose(ctx context.Context, snapshot *cache.Snapshot) (diagMap, error) {
314-
ctx, done := event.Start(ctx, "Server.diagnose", snapshot.Labels()...)
314+
ctx, done := event.Start(ctx, "server.diagnose", snapshot.Labels()...)
315315
defer done()
316316

317317
// Wait for a free diagnostics slot.
@@ -640,7 +640,7 @@ func (s *server) updateCriticalErrorStatus(ctx context.Context, snapshot *cache.
640640
// updateDiagnostics records the result of diagnosing a snapshot, and publishes
641641
// any diagnostics that need to be updated on the client.
642642
func (s *server) updateDiagnostics(ctx context.Context, snapshot *cache.Snapshot, diagnostics diagMap, final bool) {
643-
ctx, done := event.Start(ctx, "Server.publishDiagnostics")
643+
ctx, done := event.Start(ctx, "server.publishDiagnostics")
644644
defer done()
645645

646646
s.diagnosticsMu.Lock()

gopls/internal/server/folding_range.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func (s *server) FoldingRange(ctx context.Context, params *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
18-
ctx, done := event.Start(ctx, "lsp.Server.foldingRange", label.URI.Of(params.TextDocument.URI))
18+
ctx, done := event.Start(ctx, "server.FoldingRange", label.URI.Of(params.TextDocument.URI))
1919
defer done()
2020

2121
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)

gopls/internal/server/format.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
func (s *server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
20-
ctx, done := event.Start(ctx, "lsp.Server.formatting", label.URI.Of(params.TextDocument.URI))
20+
ctx, done := event.Start(ctx, "server.Formatting", label.URI.Of(params.TextDocument.URI))
2121
defer done()
2222

2323
fh, snapshot, release, err := s.fileOf(ctx, params.TextDocument.URI)

gopls/internal/server/general.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
func (s *server) Initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error) {
41-
ctx, done := event.Start(ctx, "lsp.Server.initialize")
41+
ctx, done := event.Start(ctx, "server.Initialize")
4242
defer done()
4343

4444
var clientName string
@@ -208,7 +208,7 @@ func (s *server) Initialize(ctx context.Context, params *protocol.ParamInitializ
208208
}
209209

210210
func (s *server) Initialized(ctx context.Context, params *protocol.InitializedParams) error {
211-
ctx, done := event.Start(ctx, "lsp.Server.initialized")
211+
ctx, done := event.Start(ctx, "server.Initialized")
212212
defer done()
213213

214214
s.stateMu.Lock()
@@ -635,7 +635,7 @@ func (s *server) fileOf(ctx context.Context, uri protocol.DocumentURI) (file.Han
635635
// Shutdown implements the 'shutdown' LSP handler. It releases resources
636636
// associated with the server and waits for all ongoing work to complete.
637637
func (s *server) Shutdown(ctx context.Context) error {
638-
ctx, done := event.Start(ctx, "lsp.Server.shutdown")
638+
ctx, done := event.Start(ctx, "server.Shutdown")
639639
defer done()
640640

641641
s.stateMu.Lock()
@@ -662,7 +662,7 @@ func (s *server) Shutdown(ctx context.Context) error {
662662
}
663663

664664
func (s *server) Exit(ctx context.Context) error {
665-
ctx, done := event.Start(ctx, "lsp.Server.exit")
665+
ctx, done := event.Start(ctx, "server.Exit")
666666
defer done()
667667

668668
s.stateMu.Lock()

0 commit comments

Comments
 (0)