Skip to content

Commit f8830f1

Browse files
sergeibbbd13
authored andcommitted
Removes Walkthroug from Home on Cursor
(#3837, #4390)
1 parent 83e97d8 commit f8830f1

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

src/container.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { log } from './system/decorators/log';
5959
import { Logger } from './system/logger';
6060
import { TelemetryService } from './telemetry/telemetry';
6161
import { UsageTracker } from './telemetry/usageTracker';
62-
import { WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
62+
import { isWalkthroughSupported, WalkthroughStateProvider } from './telemetry/walkthroughStateProvider';
6363
import { GitTerminalLinkProvider } from './terminal/linkProvider';
6464
import { GitDocumentTracker } from './trackers/documentTracker';
6565
import { LineTracker } from './trackers/lineTracker';
@@ -205,7 +205,9 @@ export class Container {
205205
);
206206
this._disposables.push((this._uri = new UriService(this)));
207207
this._disposables.push((this._subscription = new SubscriptionService(this, this._connection, previousVersion)));
208-
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
208+
if (isWalkthroughSupported()) {
209+
this._disposables.push((this._walkthrough = new WalkthroughStateProvider(this)));
210+
}
209211
this._disposables.push((this._organizations = new OrganizationService(this, this._connection)));
210212

211213
this._disposables.push((this._git = new GitProviderService(this)));
@@ -713,8 +715,8 @@ export class Container {
713715
return this._usage;
714716
}
715717

716-
private readonly _walkthrough: WalkthroughStateProvider;
717-
get walkthrough(): WalkthroughStateProvider {
718+
private readonly _walkthrough: WalkthroughStateProvider | undefined;
719+
get walkthrough(): WalkthroughStateProvider | undefined {
718720
return this._walkthrough;
719721
}
720722

src/system/-webview/cursor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { env } from 'vscode';
2+
3+
/**
4+
* Checks if the current IDE is Cursor
5+
* @returns true if the current IDE is Cursor, false otherwise
6+
*/
7+
export function isCursor(): boolean {
8+
return env.appName === 'Cursor';
9+
}

src/telemetry/walkthroughStateProvider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { TrackedUsageKeys } from '../constants.telemetry';
55
import type { Container } from '../container';
66
import type { SubscriptionChangeEvent } from '../plus/gk/subscriptionService';
77
import { setContext } from '../system/-webview/context';
8+
import { isCursor } from '../system/-webview/cursor';
89
import { wait } from '../system/promise';
910
import type { UsageChangeEvent } from './usageTracker';
1011

@@ -319,3 +320,7 @@ export class WalkthroughStateProvider implements Disposable {
319320
return true;
320321
}
321322
}
323+
324+
export function isWalkthroughSupported(): boolean {
325+
return !isCursor();
326+
}

src/webviews/home/homeWebview.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
170170
this.container.subscription.onDidChange(this.onSubscriptionChanged, this),
171171
onDidChangeContext(this.onContextChanged, this),
172172
this.container.integrations.onDidChange(this.onIntegrationsChanged, this),
173-
this.container.walkthrough.onDidChangeProgress(this.onWalkthroughProgressChanged, this),
173+
this.container.walkthrough?.onDidChangeProgress(this.onWalkthroughProgressChanged, this) ?? emptyDisposable,
174174
configuration.onDidChange(this.onDidChangeConfig, this),
175175
this.container.launchpad.onDidChange(this.onLaunchpadChanged, this),
176176
this.container.ai.onDidChangeModel(this.onAIModelChanged, this),
@@ -729,7 +729,9 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
729729
}
730730

731731
private getWalkthroughDismissed() {
732-
return this.container.storage.get('home:walkthrough:dismissed') ?? false;
732+
return (
733+
this.container.walkthrough == null || (this.container.storage.get('home:walkthrough:dismissed') ?? false)
734+
);
733735
}
734736

735737
private getPreviewCollapsed() {
@@ -806,13 +808,14 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
806808
integrations: integrations,
807809
ai: ai,
808810
hasAnyIntegrationConnected: anyConnected,
809-
walkthroughProgress: !this.getWalkthroughDismissed()
810-
? {
811-
allCount: this.container.walkthrough.walkthroughSize,
812-
doneCount: this.container.walkthrough.doneCount,
813-
progress: this.container.walkthrough.progress,
814-
}
815-
: undefined,
811+
walkthroughProgress:
812+
!this.getWalkthroughDismissed() && this.container.walkthrough != null
813+
? {
814+
allCount: this.container.walkthrough.walkthroughSize,
815+
doneCount: this.container.walkthrough.doneCount,
816+
progress: this.container.walkthrough.progress,
817+
}
818+
: undefined,
816819
previewEnabled: this.getPreviewEnabled(),
817820
newInstall: getContext('gitlens:install:new', false),
818821
amaBannerCollapsed: this.getAmaBannerCollapsed(),
@@ -1205,6 +1208,8 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
12051208
}
12061209

12071210
private notifyDidChangeProgress() {
1211+
if (this.container.walkthrough == null) return;
1212+
12081213
void this.host.notify(DidChangeWalkthroughProgress, {
12091214
allCount: this.container.walkthrough.walkthroughSize,
12101215
doneCount: this.container.walkthrough.doneCount,

0 commit comments

Comments
 (0)