@@ -28,6 +28,7 @@ import (
28
28
"golang.org/x/tools/gopls/internal/protocol"
29
29
"golang.org/x/tools/gopls/internal/protocol/semtok"
30
30
"golang.org/x/tools/gopls/internal/settings"
31
+ "golang.org/x/tools/gopls/internal/telemetry"
31
32
"golang.org/x/tools/gopls/internal/util/bug"
32
33
"golang.org/x/tools/gopls/internal/util/goversion"
33
34
"golang.org/x/tools/gopls/internal/util/moremaps"
@@ -74,7 +75,11 @@ func (s *server) Initialize(ctx context.Context, params *protocol.ParamInitializ
74
75
// TODO(rfindley): eliminate this defer.
75
76
defer func () { s .SetOptions (options ) }()
76
77
77
- s .handleOptionErrors (ctx , options .Set (params .InitializationOptions ))
78
+ // Process initialization options.
79
+ {
80
+ res , errs := options .Set (params .InitializationOptions )
81
+ s .handleOptionResult (ctx , res , errs )
82
+ }
78
83
options .ForClientCapabilities (params .ClientInfo , params .Capabilities )
79
84
80
85
if options .ShowBugReports {
@@ -541,7 +546,8 @@ func (s *server) fetchFolderOptions(ctx context.Context, folder protocol.Documen
541
546
542
547
opts = opts .Clone ()
543
548
for _ , config := range configs {
544
- s .handleOptionErrors (ctx , opts .Set (config ))
549
+ res , errs := opts .Set (config )
550
+ s .handleOptionResult (ctx , res , errs )
545
551
}
546
552
return opts , nil
547
553
}
@@ -555,7 +561,12 @@ func (s *server) eventuallyShowMessage(ctx context.Context, msg *protocol.ShowMe
555
561
s .notifications = append (s .notifications , msg )
556
562
}
557
563
558
- func (s * server ) handleOptionErrors (ctx context.Context , optionErrors []error ) {
564
+ func (s * server ) handleOptionResult (ctx context.Context , applied []telemetry.CounterPath , optionErrors []error ) {
565
+ for _ , path := range applied {
566
+ path = append (settings.CounterPath {"gopls" , "setting" }, path ... )
567
+ counter .Inc (path .FullName ())
568
+ }
569
+
559
570
var warnings , errs []string
560
571
for _ , err := range optionErrors {
561
572
if err == nil {
0 commit comments