Skip to content

Commit ca9b428

Browse files
authored
Fix feedback service (#246)
* Fix microsoft/vscode#37627 (#1368)
1 parent e3869bf commit ca9b428

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/client/feedback/feedbackService.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ export class FeedbackService implements Disposable {
2828
constructor(persistentStateFactory: IPersistentStateFactory) {
2929
this.showFeedbackPrompt = persistentStateFactory.createGlobalPersistentState('SHOW_FEEDBACK_PROMPT', true);
3030
this.userResponded = persistentStateFactory.createGlobalPersistentState('RESPONDED_TO_FEEDBACK', false);
31-
if (this.showFeedbackPrompt.value && !this.userResponded.value) {
32-
this.initialize();
33-
}
31+
this.initialize();
3432
}
3533
public dispose() {
3634
this.counters = undefined;
@@ -44,6 +42,9 @@ export class FeedbackService implements Disposable {
4442
// tslint:disable-next-line:no-void-expression
4543
let commandDisable = commands.registerCommand('python.updateFeedbackCounter', (telemetryEventName: string) => this.updateFeedbackCounter(telemetryEventName));
4644
this.disposables.push(commandDisable);
45+
if (!this.showFeedbackPrompt.value || this.userResponded.value) {
46+
return;
47+
}
4748
// tslint:disable-next-line:no-void-expression
4849
commandDisable = workspace.onDidChangeTextDocument(changeEvent => this.handleChangesToTextDocument(changeEvent.document), this, this.disposables);
4950
this.disposables.push(commandDisable);
@@ -60,7 +61,8 @@ export class FeedbackService implements Disposable {
6061
if (!this.canShowPrompt) {
6162
return;
6263
}
63-
this.counters.incrementEditCounter();
64+
// tslint:disable-next-line:no-non-null-assertion
65+
this.counters!.incrementEditCounter();
6466
}
6567
private updateFeedbackCounter(telemetryEventName: string): void {
6668
// Ignore feedback events.
@@ -70,7 +72,8 @@ export class FeedbackService implements Disposable {
7072
if (!this.canShowPrompt) {
7173
return;
7274
}
73-
this.counters.incrementFeatureUsageCounter();
75+
// tslint:disable-next-line:no-non-null-assertion
76+
this.counters!.incrementFeatureUsageCounter();
7477
}
7578
private thresholdHandler() {
7679
if (!this.canShowPrompt) {

0 commit comments

Comments
 (0)