From 499d99e70561d916b76c5356a2e2e3e1b18e40d0 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 11 Jan 2018 00:18:45 -0500 Subject: [PATCH] Adds a notification when results view is first shown --- CHANGELOG.md | 1 + package.json | 5 +++++ src/configuration.ts | 2 ++ src/messages.ts | 9 +++++++-- src/views/resultsExplorer.ts | 10 ++++++++-- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e70e7c5..72ed409 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Adds *Revert Commit (via Terminal)* command (`gitlens.explorers.terminalRevertCommit`) to revision (commit) nodes in the **GitLens** & **GitLens Results** views - Adds *Create Tag (via Terminal)...* command (`gitlens.explorers.terminalCreateTag`) to branch and revision (commit) nodes in the **GitLens** & **GitLens Results** views - Adds *Delete Tag (via Terminal)* command (`gitlens.explorers.terminalDeleteTag`) to tag nodes in the **GitLens** view +- Adds a helpful notification the first time the **GitLens Results** view is shown ### Changed - Renames *Rebase Commit (via Terminal)* command (`gitlens.terminalRebaseCommit`) to *Rebase to Commit (via Terminal)* diff --git a/package.json b/package.json index 1b6dbff..90ceb97 100644 --- a/package.json +++ b/package.json @@ -1028,6 +1028,7 @@ "suppressGitVersionWarning": false, "suppressLineUncommittedWarning": false, "suppressNoRepositoryWarning": false, + "suppressResultsExplorerNotice": false, "suppressUpdateNotice": false, "suppressWelcomeNotice": false }, @@ -1056,6 +1057,10 @@ "type": "boolean", "default": false }, + "suppressResultsExplorerNotice": { + "type": "boolean", + "default": false + }, "suppressUpdateNotice": { "type": "boolean", "default": false diff --git a/src/configuration.ts b/src/configuration.ts index 79ad88d..4cc7cd9 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -121,6 +121,7 @@ export interface IAdvancedConfig { suppressGitVersionWarning: boolean, suppressLineUncommittedWarning: boolean, suppressNoRepositoryWarning: boolean, + suppressResultsExplorerNotice: boolean, suppressUpdateNotice: boolean, suppressWelcomeNotice: boolean }; @@ -506,6 +507,7 @@ const emptyConfig: IConfig = { suppressGitVersionWarning: false, suppressLineUncommittedWarning: false, suppressNoRepositoryWarning: false, + suppressResultsExplorerNotice: false, suppressUpdateNotice: false, suppressWelcomeNotice: false }, diff --git a/src/messages.ts b/src/messages.ts index ba63cad..a9fa655 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -12,6 +12,7 @@ export enum SuppressedMessages { GitVersionWarning = 'suppressGitVersionWarning', LineUncommittedWarning = 'suppressLineUncommittedWarning', NoRepositoryWarning = 'suppressNoRepositoryWarning', + ResultsExplorerNotice = 'suppressResultsExplorerNotice', UpdateNotice = 'suppressUpdateNotice', WelcomeNotice = 'suppressWelcomeNotice' } @@ -39,8 +40,12 @@ export class Messages { return Messages.showMessage('warn', `${message}. No repository could be found`, SuppressedMessages.NoRepositoryWarning); } + static showResultExplorerInfoMessage(): Promise { + return Messages.showMessage('info', `If you can't find your results, click on "GITLENS RESULTS" at the bottom of the Explorer view`, SuppressedMessages.ResultsExplorerNotice, null); + } + static showUnsupportedGitVersionErrorMessage(version: string): Promise { - return Messages.showMessage('error', `GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git.`, SuppressedMessages.GitVersionWarning); + return Messages.showMessage('error', `GitLens requires a newer version of Git (>= 2.2.0) than is currently installed (${version}). Please install a more recent version of Git`, SuppressedMessages.GitVersionWarning); } static async showUpdateMessage(version: string): Promise { @@ -54,7 +59,7 @@ export class Messages { static async showWelcomeMessage(): Promise { const viewDocs = 'View Docs'; - const result = await Messages.showMessage('info', `Thank you for choosing GitLens! GitLens is powerful, feature rich, and highly configurable, so please be sure to view the docs and tailor it to suit your needs.`, SuppressedMessages.WelcomeNotice, null, viewDocs); + const result = await Messages.showMessage('info', `Thank you for choosing GitLens! GitLens is powerful, feature rich, and highly configurable, so please be sure to view the docs and tailor it to suit your needs`, SuppressedMessages.WelcomeNotice, null, viewDocs); if (result === viewDocs) { commands.executeCommand(BuiltInCommands.Open, Uri.parse('https://marketplace.visualstudio.com/items/eamodio.gitlens')); } diff --git a/src/views/resultsExplorer.ts b/src/views/resultsExplorer.ts index b00aeac..2d70938 100644 --- a/src/views/resultsExplorer.ts +++ b/src/views/resultsExplorer.ts @@ -8,6 +8,7 @@ import { RefreshNodeCommandArgs } from './explorerCommands'; import { CommitResultsNode, CommitsResultsNode, ComparisionResultsNode, ExplorerNode, MessageNode, RefreshReason, ResourceType } from './explorerNodes'; import { clearGravatarCache, GitLog, GitLogCommit } from '../gitService'; import { Logger } from '../logger'; +import { Messages } from '../messages'; export * from './explorerNodes'; @@ -115,12 +116,12 @@ export class ResultsExplorer implements TreeDataProvider { async showComparisonInResults(repoPath: string, ref1: string, ref2: string) { this.addResults(new ComparisionResultsNode(repoPath, ref1, ref2, this)); - setCommandContext(CommandContext.ResultsExplorer, true); + this.showResults(); } showCommitInResults(commit: GitLogCommit) { this.addResults(new CommitResultsNode(commit, this)); - setCommandContext(CommandContext.ResultsExplorer, true); + this.showResults(); } showCommitsInResults(results: GitLog, resultsLabel: string | { label: string, resultsType?: { singular: string, plural: string } }) { @@ -143,6 +144,11 @@ export class ResultsExplorer implements TreeDataProvider { }; this.addResults(new CommitsResultsNode(results.repoPath, labelFn, Functions.seeded(query, results), this, ResourceType.SearchResults)); + this.showResults(); + } + + private showResults() { + Messages.showResultExplorerInfoMessage(); setCommandContext(CommandContext.ResultsExplorer, true); }