From a59b8f817e82c8c41bad133a541447f424862028 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 20 Sep 2020 01:43:10 -0400 Subject: [PATCH] Adds a welcome view --- package.json | 33 +++++++++++++++++++++++++++++++++ src/commands.ts | 1 + src/commands/closeWelcomeView.ts | 14 ++++++++++++++ src/commands/common.ts | 1 + src/config.ts | 5 +++++ 5 files changed, 54 insertions(+) create mode 100644 src/commands/closeWelcomeView.ts diff --git a/package.json b/package.json index 04c616f..a6512ec 100644 --- a/package.json +++ b/package.json @@ -2030,6 +2030,12 @@ "markdownDescription": "Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the _Tags_ view. Only applies when `#gitlens.views.tags.files.layout#` is set to `auto`", "scope": "window" }, + "gitlens.views.welcome.enabled": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to show the _Welcome_ view", + "scope": "window" + }, "gitlens.advanced.abbreviatedShaLength": { "type": "number", "default": "7", @@ -7507,7 +7513,34 @@ } ] }, + "viewsWelcome": [ + { + "view": "gitlens.views.welcome", + "contents": "GitLens is powerful and feature rich, while also highly customizable. You can use the GitLens Welcome experience to quickly customize GitLens to meet your needs. And for many more options, use the GitLens Interactive Settings.\n\n[Welcome (Quick Setup)](command:gitlens.showWelcomePage \"Opens GitLens Quick Setup\")\n\n[Open Settings](command:gitlens.showSettingsPage \"Opens GitLens Interactive Settings\")" + }, + { + "view": "gitlens.views.welcome", + "contents": "You can also quickly switch between different side bar layouts for GitLens views to best match your workflow.\n\n[Change View Layout](command:gitlens.setViewsLayout \"Change GitLens Views Layout\")" + }, + { + "view": "gitlens.views.welcome", + "contents": "While GitLens is generously offered to everyone free of charge, if you find it useful, please consider sponsoring it.\n\n[Sponsor GitLens ❤](command:gitlens.supportGitLens \"Sponsor GitLens\")" + }, + { + "view": "gitlens.views.welcome", + "contents": "Once you are satisfied, feel free to close this view.\n\n[Close Welcome View](command:gitlens.closeWelcomeView \"Close View\")" + } + ], "views": { + "gitlens": [ + { + "id": "gitlens.views.welcome", + "name": "Welcome", + "when": "config.gitlens.views.welcome.enabled", + "contextualTitle": "GitLens", + "icon": "images/gitlens-activitybar.svg" + } + ], "scm": [ { "id": "gitlens.views.repositories", diff --git a/src/commands.ts b/src/commands.ts index 74eb665..20c3459 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -3,6 +3,7 @@ export * from './commands/addAuthors'; export * from './commands/browseRepoAtRevision'; export * from './commands/closeUnchangedFiles'; +export * from './commands/closeWelcomeView'; export * from './commands/common'; export * from './commands/copyMessageToClipboard'; export * from './commands/copyShaToClipboard'; diff --git a/src/commands/closeWelcomeView.ts b/src/commands/closeWelcomeView.ts new file mode 100644 index 0000000..57308e7 --- /dev/null +++ b/src/commands/closeWelcomeView.ts @@ -0,0 +1,14 @@ +'use strict'; +import { configuration } from '../configuration'; +import { command, Command, Commands } from './common'; + +@command() +export class CloseWelcomeViewCommand extends Command { + constructor() { + super(Commands.CloseWelcomeView); + } + + async execute() { + void (await configuration.updateEffective('views', 'welcome', 'enabled', false)); + } +} diff --git a/src/commands/common.ts b/src/commands/common.ts index 11d96b7..b1e5e2e 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -29,6 +29,7 @@ export enum Commands { BrowseRepoAtRevisionInNewWindow = 'gitlens.browseRepoAtRevisionInNewWindow', ClearFileAnnotations = 'gitlens.clearFileAnnotations', CloseUnchangedFiles = 'gitlens.closeUnchangedFiles', + CloseWelcomeView = 'gitlens.closeWelcomeView', ComputingFileAnnotations = 'gitlens.computingFileAnnotations', ConnectRemoteProvider = 'gitlens.connectRemoteProvider', CopyMessageToClipboard = 'gitlens.copyMessageToClipboard', diff --git a/src/config.ts b/src/config.ts index e86b6e7..a3cf204 100644 --- a/src/config.ts +++ b/src/config.ts @@ -434,6 +434,7 @@ interface ViewsConfigs { search: SearchViewConfig; stashes: StashesViewConfig; tags: TagsViewConfig; + welcome: WelcomeViewConfig; } export type ViewsConfigKeys = keyof ViewsConfigs; @@ -526,6 +527,10 @@ export interface TagsViewConfig { files: ViewsFilesConfig; } +export interface WelcomeViewConfig { + enabled: boolean; +} + export interface ViewsFilesConfig { compact: boolean; layout: ViewFilesLayout;