MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / constructor

Method constructor

src/extension/analytics.ts:203–235  ·  view source on GitHub ↗
(private readonly logger: Logger)

Source from the content-addressed store, hash-verified

201 public workspaceContext: WorkspaceContext | undefined;
202
203 constructor(private readonly logger: Logger) {
204 this.formatter = this.getFormatterSetting();
205 this.exceptionBreakTrackerFactory = new DebugAdapterExceptionSettingTrackerFactory();
206 this.disposables.push(debug.registerDebugAdapterTrackerFactory("dart", this.exceptionBreakTrackerFactory));
207
208 // If the API isn't supported (Theia) then we'll just not set anything up.
209 if (!env.createTelemetryLogger) {
210 this.logger.info("createTelemetryLogger is unsupported");
211 return;
212 }
213
214 // Check if the user has set the DO_NOT_TRACK env var.
215 // https://donottrack.sh/
216 if (process.env.DO_NOT_TRACK === "1") {
217 this.logger.info("User is opted out via DO_NOT_TRACK env var");
218 return;
219 }
220
221 // Similarly, if the user has opted out of Dart/Flutter's telemetry, we should assume they might
222 // (reasonably) expect that covers this extension, so don't set anything up in that case either.
223 if (this.isOptedOutOfDartToolingTelemetry()) {
224 this.logger.info("User is opted out of Dart tooling analytics");
225 return;
226 }
227
228 if (!env.isTelemetryEnabled) {
229 this.logger.info(`VS Code telemetry is disabled, analytics events will not be sent unless re-enabled`);
230 // Don't return, as we check this on each event.
231 }
232
233 const googleAnalyticsTelemetrySender = new GoogleAnalyticsTelemetrySender(logger, (e) => this.handleError(e));
234 this.telemetryLogger = env.createTelemetryLogger(googleAnalyticsTelemetrySender);
235 }
236
237 /// If a user opts-out of Dart/Flutter telemetry with the command line apps, also opt-out here to avoid
238 /// confusion between Dart/Flutter analytics being reported to Google and extension analytics going

Callers

nothing calls this directly

Calls 4

getFormatterSettingMethod · 0.95
handleErrorMethod · 0.95
infoMethod · 0.65

Tested by

no test coverage detected