@@ -7,11 +7,11 @@ import {
7
7
EventEmitter ,
8
8
commands ,
9
9
ProviderResult ,
10
- window ,
11
10
} from 'vscode' ;
12
- import { RequestType , RequestType0 } from 'vscode-languageclient' ;
11
+ import { RequestType0 } from 'vscode-languageclient' ;
13
12
import { ConnectionHandler } from '../handler' ;
14
- import { PuppetVersionRequest , PuppetVersionDetails } from '../messages' ;
13
+ import { PuppetVersionDetails } from '../messages' ;
14
+ import { reporter } from '../telemetry' ;
15
15
16
16
class PuppetFact extends TreeItem {
17
17
constructor (
@@ -81,7 +81,7 @@ export class PuppetFactsProvider implements TreeDataProvider<PuppetFact> {
81
81
) ;
82
82
if ( ! details . factsLoaded ) {
83
83
// language server is ready, but hasn't loaded facts yet
84
- return new Promise < PuppetFact [ ] > ( ( resolve , reject ) => {
84
+ return new Promise < PuppetFact [ ] > ( ( resolve ) => {
85
85
let count = 0 ;
86
86
let handle = setInterval ( async ( ) => {
87
87
count ++ ;
@@ -93,6 +93,10 @@ export class PuppetFactsProvider implements TreeDataProvider<PuppetFact> {
93
93
) ;
94
94
this . elements = this . toList ( results . facts ) ;
95
95
96
+ if ( reporter ) {
97
+ reporter . sendTelemetryEvent ( 'puppetFacts' ) ;
98
+ }
99
+
96
100
resolve ( this . elements . map ( ( e ) => e [ 1 ] ) ) ;
97
101
}
98
102
@@ -107,6 +111,10 @@ export class PuppetFactsProvider implements TreeDataProvider<PuppetFact> {
107
111
) ;
108
112
this . elements = this . toList ( results . facts ) ;
109
113
114
+ if ( reporter ) {
115
+ reporter . sendTelemetryEvent ( 'puppetFacts' ) ;
116
+ }
117
+
110
118
resolve ( this . elements . map ( ( e ) => e [ 1 ] ) ) ;
111
119
} else {
112
120
// not ready yet
@@ -119,6 +127,11 @@ export class PuppetFactsProvider implements TreeDataProvider<PuppetFact> {
119
127
new RequestType0 < PuppetFactResponse , void , void > ( 'puppet/getFacts' )
120
128
) ;
121
129
this . elements = this . toList ( results . facts ) ;
130
+
131
+ if ( reporter ) {
132
+ reporter . sendTelemetryEvent ( 'puppetFacts' ) ;
133
+ }
134
+
122
135
return this . elements . map ( ( e ) => e [ 1 ] ) ;
123
136
}
124
137
0 commit comments