diff --git a/package.json b/package.json index e7838549781f5..2287f26430470 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "onCommand:gitlens.premium.startPreview", "onCommand:gitlens.premium.purchase", "onCommand:gitlens.premium.reset", + "onCommand:gitlens.getStarted", "onCommand:gitlens.showSettingsPage", "onCommand:gitlens.showSettingsPage#views", "onCommand:gitlens.showSettingsPage#branches-view", @@ -89,6 +90,7 @@ "onCommand:gitlens.showCommitsView", "onCommand:gitlens.showContributorsView", "onCommand:gitlens.showFileHistoryView", + "onCommand:gitlens.showHomeView", "onCommand:gitlens.showLineHistoryView", "onCommand:gitlens.showRemotesView", "onCommand:gitlens.showRepositoriesView", @@ -96,8 +98,6 @@ "onCommand:gitlens.showStashesView", "onCommand:gitlens.showTagsView", "onCommand:gitlens.showWorktreesView", - "onCommand:gitlens.showWelcomeView", - "onCommand:gitlens.closeWelcomeView", "onCommand:gitlens.compareWith", "onCommand:gitlens.compareHeadWith", "onCommand:gitlens.compareWorkingWith", @@ -3624,6 +3624,11 @@ "title": "Reset...", "category": "GitLens Premium" }, + { + "command": "gitlens.getStarted", + "title": "Get Started", + "category": "GitLens" + }, { "command": "gitlens.showSettingsPage", "title": "Open Settings", @@ -3727,6 +3732,11 @@ "title": "Show File History View", "category": "GitLens" }, + { + "command": "gitlens.showHomeView", + "title": "Show Home View", + "category": "GitLens" + }, { "command": "gitlens.showLineHistoryView", "title": "Show Line History View", @@ -3762,17 +3772,6 @@ "title": "Show Worktrees View", "category": "GitLens" }, - { - "command": "gitlens.showWelcomeView", - "title": "Show Welcome View", - "category": "GitLens" - }, - { - "command": "gitlens.closeWelcomeView", - "title": "Close", - "category": "GitLens", - "icon": "$(close)" - }, { "command": "gitlens.compareWith", "title": "Compare References...", @@ -5977,6 +5976,10 @@ "command": "gitlens.showFileHistoryView", "when": "gitlens:enabled" }, + { + "command": "gitlens.showHomeView", + "when": "gitlens:enabled" + }, { "command": "gitlens.showLineHistoryView", "when": "gitlens:enabled && !gitlens:hasVirtualFolders" @@ -6003,15 +6006,7 @@ }, { "command": "gitlens.showWorktreesView", - "when": "gitlens:enabled" - }, - { - "command": "gitlens.showWelcomeView", - "when": "gitlens:enabled" - }, - { - "command": "gitlens.closeWelcomeView", - "when": "false" + "when": "gitlens:enabled && !gitlens:hasVirtualFolders" }, { "command": "gitlens.compareWith", @@ -7685,14 +7680,19 @@ ], "extension/context": [ { - "command": "gitlens.showWelcomePage", + "command": "gitlens.getStarted", "when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed", "group": "9_gitlens@1" }, { - "command": "gitlens.showSettingsPage", + "command": "gitlens.showWelcomePage", "when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed", "group": "9_gitlens@2" + }, + { + "command": "gitlens.showSettingsPage", + "when": "extension =~ /^eamodio.gitlens(-insiders)?$/ && extensionStatus == installed", + "group": "9_gitlens@3" } ], "git.commit": [ @@ -7789,11 +7789,6 @@ } ], "view/title": [ - { - "command": "gitlens.closeWelcomeView", - "when": "view == gitlens.views.welcome", - "group": "navigation@1" - }, { "command": "gitlens.views.switchToAnotherBranch", "when": "!gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && view =~ /^gitlens\\.views\\.branches/", @@ -10529,18 +10524,6 @@ ] }, "viewsWelcome": [ - { - "view": "gitlens.views.welcome", - "contents": "GitLens 11 is powerful, feature rich, and highly customizable to meet your needs. You can use the GitLens Welcome experience to get setup quickly.\n\n[Welcome (Quick Setup)](command:gitlens.showWelcomePage \"Opens the GitLens Welcome (Quick Setup)\")\n\nFor more options, run [GitLens: Open Settings](command:gitlens.showSettingsPage \"Opens the GitLens Interactive Settings\") from the Command Palette to open the interactive GitLens settings editor." - }, - { - "view": "gitlens.views.welcome", - "contents": "[GitLens views](command:gitlens.showSettingsPage%23views) are shown on the Source Control side bar, by default. Run [GitLens: Set Views Layout](command:gitlens.setViewsLayout \"Changes the GitLens Views Layout\") from the Command Palette to switch to an alternate side bar layout, or drag & drop them." - }, - { - "view": "gitlens.views.welcome", - "contents": "[Close](command:gitlens.closeWelcomeView \"Closes the Welcome view\")" - }, { "view": "gitlens.views.searchAndCompare", "contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [file](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22file%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [changes](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22pattern%22%3A%22change%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)", @@ -10597,15 +10580,7 @@ "type": "webview", "id": "gitlens.views.home", "name": "Home", - "-when": "!gitlens:disabled && gitlens:views:home:visible != false", - "contextualTitle": "GitLens", - "icon": "images/gitlens-activitybar.svg", - "visibility": "visible" - }, - { - "id": "gitlens.views.welcome", - "name": "Welcome", - "when": "gitlens:views:welcome:visible != false", + "-when": "!gitlens:disabled", "contextualTitle": "GitLens", "icon": "images/gitlens-activitybar.svg", "visibility": "visible" diff --git a/src/commands.ts b/src/commands.ts index d4bad30f94be7..00a6121d2dd86 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,7 +1,6 @@ export * from './commands/addAuthors'; export * from './commands/browseRepoAtRevision'; export * from './commands/closeUnchangedFiles'; -export * from './commands/closeView'; export * from './commands/compareWith'; export * from './commands/copyCurrentBranch'; export * from './commands/copyMessageToClipboard'; @@ -17,6 +16,7 @@ export * from './commands/diffWithRevision'; export * from './commands/diffWithRevisionFrom'; export * from './commands/diffWithWorking'; export * from './commands/externalDiff'; +export * from './commands/getStarted'; export * from './commands/gitCommands'; export * from './commands/inviteToLiveShare'; export * from './commands/logging'; diff --git a/src/commands/closeView.ts b/src/commands/closeView.ts deleted file mode 100644 index 6d9dc1899f2e3..0000000000000 --- a/src/commands/closeView.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Commands, ContextKeys } from '../constants'; -import type { Container } from '../container'; -import { setContext } from '../context'; -import { SyncedStorageKeys } from '../storage'; -import { command } from '../system/command'; -import { Command, CommandContext } from './base'; - -@command() -export class CloseViewCommand extends Command { - constructor(private readonly container: Container) { - super([Commands.CloseWelcomeView]); - } - - protected override preExecute(context: CommandContext) { - return this.execute(context.command as Commands); - } - - async execute(command: Commands) { - switch (command) { - case Commands.CloseWelcomeView: - await this.container.storage.store(SyncedStorageKeys.WelcomeViewVisible, false); - await setContext(ContextKeys.ViewsWelcomeVisible, false); - break; - } - } -} diff --git a/src/commands/getStarted.ts b/src/commands/getStarted.ts new file mode 100644 index 0000000000000..c7d51faef5562 --- /dev/null +++ b/src/commands/getStarted.ts @@ -0,0 +1,22 @@ +import { Commands, CoreCommands } from '../constants'; +import type { Container } from '../container'; +import { command, executeCoreCommand } from '../system/command'; +import { Command } from './base'; + +@command() +export class GetStartedCommand extends Command { + constructor(private readonly container: Container) { + super(Commands.GetStarted); + } + + execute(step?: string) { + const id = this.container.context.extension.id; + // If the step param is the same as the extension id, then this was run from the extensions view gear menu + if (step === id) { + step = undefined; + } + + // Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined + void executeCoreCommand(CoreCommands.OpenWalkthrough, `${id}#${step ?? 'gitlens.welcome'}`, true); + } +} diff --git a/src/commands/showView.ts b/src/commands/showView.ts index 99e6d21e2158b..c95c282f2c4b6 100644 --- a/src/commands/showView.ts +++ b/src/commands/showView.ts @@ -1,7 +1,5 @@ -import { Commands, ContextKeys } from '../constants'; +import { Commands } from '../constants'; import type { Container } from '../container'; -import { setContext } from '../context'; -import { SyncedStorageKeys } from '../storage'; import { command, executeCommand } from '../system/command'; import { Command, CommandContext } from './base'; @@ -20,7 +18,6 @@ export class ShowViewCommand extends Command { Commands.ShowStashesView, Commands.ShowTagsView, Commands.ShowWorktreesView, - Commands.ShowWelcomeView, Commands.ShowHomeView, ]); } @@ -53,11 +50,6 @@ export class ShowViewCommand extends Command { return this.container.tagsView.show(); case Commands.ShowWorktreesView: return this.container.worktreesView.show(); - case Commands.ShowWelcomeView: - await setContext(ContextKeys.ViewsWelcomeVisible, true); - void this.container.storage.store(SyncedStorageKeys.WelcomeViewVisible, true); - void (await executeCommand('gitlens.views.welcome.focus')); - break; case Commands.ShowHomeView: void (await executeCommand('gitlens.views.home.focus')); break; diff --git a/src/constants.ts b/src/constants.ts index becf0af8c20fb..10ff3ecc76cc1 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -98,6 +98,7 @@ export const enum Commands { ExternalDiff = 'gitlens.externalDiff', ExternalDiffAll = 'gitlens.externalDiffAll', FetchRepositories = 'gitlens.fetchRepositories', + GetStarted = 'gitlens.getStarted', InviteToLiveShare = 'gitlens.inviteToLiveShare', OpenBlamePriorToChange = 'gitlens.openBlamePriorToChange', OpenBranchesOnRemote = 'gitlens.openBranchesOnRemote', @@ -182,7 +183,6 @@ export const enum Commands { ShowTagsView = 'gitlens.showTagsView', ShowWorktreesView = 'gitlens.showWorktreesView', ShowWelcomePage = 'gitlens.showWelcomePage', - ShowWelcomeView = 'gitlens.showWelcomeView', StashApply = 'gitlens.stashApply', StashSave = 'gitlens.stashSave', StashSaveFiles = 'gitlens.stashSaveFiles', @@ -238,7 +238,6 @@ export const enum ContextKeys { ViewsLineHistoryEditorFollowing = 'gitlens:views:lineHistory:editorFollowing', ViewsRepositoriesAutoRefresh = 'gitlens:views:repositories:autoRefresh', ViewsSearchAndCompareKeepResults = 'gitlens:views:searchAndCompare:keepResults', - ViewsWelcomeVisible = 'gitlens:views:welcome:visible', Vsls = 'gitlens:vsls', Premium = 'gitlens:premium', @@ -262,6 +261,7 @@ export const enum CoreCommands { Open = 'vscode.open', OpenFolder = 'vscode.openFolder', OpenInTerminal = 'openInTerminal', + OpenWalkthrough = 'workbench.action.openWalkthrough', OpenWith = 'vscode.openWith', NextEditor = 'workbench.action.nextEditor', PreviewHtml = 'vscode.previewHtml', diff --git a/src/extension.ts b/src/extension.ts index fc594e1c132f5..def4dd0253b27 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -85,18 +85,12 @@ export async function activate(context: ExtensionContext): Promise( - SyncedStorageKeys.WelcomeViewVisible, + SyncedStorageKeys.HomeViewWelcomeVisible, )}`; } if (previousVersion == null) { - void context.globalState.update(SyncedStorageKeys.WelcomeViewVisible, true); - void setContext(ContextKeys.ViewsWelcomeVisible, true); - } else { - void setContext( - ContextKeys.ViewsWelcomeVisible, - context.globalState.get(SyncedStorageKeys.WelcomeViewVisible) ?? false, - ); + void context.globalState.update(SyncedStorageKeys.HomeViewWelcomeVisible, true); } Configuration.configure(context); @@ -165,7 +159,7 @@ function setKeysForSync(context: ExtensionContext, ...keys: (SyncedStorageKeys | return context.globalState?.setKeysForSync([ ...keys, SyncedStorageKeys.Version, - SyncedStorageKeys.WelcomeViewVisible, + SyncedStorageKeys.HomeViewWelcomeVisible, ]); } @@ -204,6 +198,9 @@ function registerBuiltInActionRunners(container: Container): void { async function showWelcomeOrWhatsNew(container: Container, version: string, previousVersion: string | undefined) { if (previousVersion == null) { Logger.log(`GitLens first-time install; window.focused=${window.state.focused}`); + + void executeCommand(Commands.ShowHomeView); + if (container.config.showWelcomeOnInstall === false) return; if (window.state.focused) { @@ -237,16 +234,15 @@ async function showWelcomeOrWhatsNew(container: Container, version: string, prev const [major, minor] = version.split('.').map(v => parseInt(v, 10)); const [prevMajor, prevMinor] = previousVersion.split('.').map(v => parseInt(v, 10)); - if ( - (major === prevMajor && minor === prevMinor) || - // Don't notify on downgrades - major < prevMajor || - (major === prevMajor && minor < prevMinor) - ) { + + // Don't notify on downgrades + if (major === prevMajor || major < prevMajor || (major === prevMajor && minor < prevMinor)) { return; } - if (major !== prevMajor && container.config.showWhatsNewAfterUpgrades) { + void executeCommand(Commands.ShowHomeView); + + if (container.config.showWhatsNewAfterUpgrades) { if (window.state.focused) { await container.storage.delete(StorageKeys.PendingWhatsNewOnFocus); await Messages.showWhatsNewMessage(version); diff --git a/src/storage.ts b/src/storage.ts index 52375d3b39b3b..0015f5553eebe 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -70,7 +70,7 @@ export const enum StorageKeys { export const enum SyncedStorageKeys { Version = 'gitlens:synced:version', - WelcomeViewVisible = 'gitlens:views:welcome:visible', + HomeViewWelcomeVisible = 'gitlens:views:welcome:visible', Deprecated_DisallowConnectionPrefix = 'gitlens:disallow:connection:', } diff --git a/src/webviews/apps/premium/home/home.html b/src/webviews/apps/premium/home/home.html index cdfe2dbc2fc82..6d102e7f20f83 100644 --- a/src/webviews/apps/premium/home/home.html +++ b/src/webviews/apps/premium/home/home.html @@ -11,7 +11,7 @@ -
+
@@ -21,8 +21,8 @@ + +