Skip to content

Commit 68515ea

Browse files
committed
gopls/internal/test/integration/fake: set LSP client name
Change-Id: I9467de61e7a08f25ae16ae59b9ae6a1dc524d1a6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/564658 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent 4231a57 commit 68515ea

File tree

1 file changed

+10
-5
lines changed
  • gopls/internal/test/integration/fake

1 file changed

+10
-5
lines changed

gopls/internal/test/integration/fake/editor.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ type EditorConfig struct {
8282
//
8383
// Since this can only be set during initialization, changing this field via
8484
// Editor.ChangeConfiguration has no effect.
85+
//
86+
// If empty, "fake.Editor" is used.
8587
ClientName string
8688

8789
// Env holds environment variables to apply on top of the default editor
@@ -282,12 +284,15 @@ func makeSettings(sandbox *Sandbox, config EditorConfig, scopeURI *protocol.URI)
282284
func (e *Editor) initialize(ctx context.Context) error {
283285
config := e.Config()
284286

287+
clientName := config.ClientName
288+
if clientName == "" {
289+
clientName = "fake.Editor"
290+
}
291+
285292
params := &protocol.ParamInitialize{}
286-
if e.config.ClientName != "" {
287-
params.ClientInfo = &protocol.ClientInfo{
288-
Name: e.config.ClientName,
289-
Version: "v1.0.0",
290-
}
293+
params.ClientInfo = &protocol.ClientInfo{
294+
Name: clientName,
295+
Version: "v1.0.0",
291296
}
292297
params.InitializationOptions = makeSettings(e.sandbox, config, nil)
293298
params.WorkspaceFolders = makeWorkspaceFolders(e.sandbox, config.WorkspaceFolders)

0 commit comments

Comments
 (0)