瀏覽代碼

Closes #377 - adds control over explorer locations

main
Eric Amodio 6 年之前
父節點
當前提交
5276288b0d
共有 9 個檔案被更改,包括 135 行新增20 行删除
  1. +11
    -1
      CHANGELOG.md
  2. +9
    -2
      README.md
  3. +50
    -3
      package.json
  4. +3
    -0
      src/ui/config.ts
  5. +29
    -5
      src/ui/settings/index.html
  6. +5
    -1
      src/ui/welcome/index.html
  7. +4
    -2
      src/views/gitExplorer.ts
  8. +11
    -5
      src/views/historyExplorer.ts
  9. +13
    -1
      src/views/resultsExplorer.ts

+ 11
- 1
CHANGELOG.md 查看文件

@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [8.3.1] - 2018-05-18
### Added
- Adds the ability to control where the *GitLens*, *GitLens History*, and *GitLens Results* explorers are shown 🎉 — closes [#213](https://github.com/eamodio/vscode-gitlens/issues/213), [#377](https://github.com/eamodio/vscode-gitlens/issues/377)
- Adds `gitlens.gitExplorer.location` setting to the interactive settings editor to specify where the *GitLens* explorer is shown — either in the *Explorer* or *Source Control* view
- Adds `gitlens.historyExplorer.location` setting to the interactive settings editor to specify where the *GitLens History* explorer is shown — either in the *Explorer* or *Source Control* view
- Adds `gitlens.resultsExplorer.location` setting to the interactive settings editor to specify where the *GitLens Results* view is shown — either in the *Explorer* or *Source Control* view
### Fixed
- Fixes [#372](https://github.com/eamodio/vscode-gitlens/issues/372) - Wrong URL to VSTS work item when using hash work item id in commit
## [8.3.0] - 2018-05-17
### Added
- Adds user-defined modes for quickly toggling between sets of settings
@ -22,7 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
![modes settings](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/cl-modes-settings.png)
- Adds `gitlens.mode.active` settings to specify the active GitLens mode, if any
- Adds `gitlens.mode.active` setting to specify the active GitLens mode, if any
- Adds `gitlens.modes` setting to specify the user-defined GitLens modes
- Adds an icon for the *Compare File with Previous Revision* command (`gitlens.diffWithPrevious`) and moves it into the editor toolbar
- Adds an icon for the *Compare File with Next Revision* command (`gitlens.diffWithNext`) and moves it into the editor toolbar

+ 9
- 2
README.md 查看文件

@ -14,7 +14,10 @@
# What's new in GitLens 8
## 8.3 — May 2018
- Moves the *GitLens*, *GitLens History*, and *GitLens Results* explorers under the Source Control activity (in the sidebar) 🎉 — closes [#213](https://github.com/eamodio/vscode-gitlens/issues/213)
- Adds the ability to control where the *GitLens*, *GitLens History*, and *GitLens Results* explorers are shown 🎉 — closes [#213](https://github.com/eamodio/vscode-gitlens/issues/213), [#377](https://github.com/eamodio/vscode-gitlens/issues/377)
- Adds `gitlens.gitExplorer.location` setting to the interactive settings editor to specify where the *GitLens* explorer is shown — either in the *Explorer* or *Source Control* view
- Adds `gitlens.historyExplorer.location` setting to the interactive settings editor to specify where the *GitLens History* explorer is shown — either in the *Explorer* or *Source Control* view
- Adds `gitlens.resultsExplorer.location` setting to the interactive settings editor to specify where the *GitLens Results* view is shown — either in the *Explorer* or *Source Control* view
- Adds user-defined modes for quickly toggling between sets of settings
![mode switch](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/cl-mode-switch.png)
@ -31,7 +34,7 @@
![modes settings](https://raw.githubusercontent.com/eamodio/vscode-gitlens/master/images/cl-modes-settings.png)
- Adds `gitlens.mode.active` settings to specify the active GitLens mode, if any
- Adds `gitlens.mode.active` setting to specify the active GitLens mode, if any
- Adds `gitlens.modes` setting to specify the user-defined GitLens modes
- Adds an icon for the *Compare File with Previous Revision* command (`gitlens.diffWithPrevious`) and moves it into the editor toolbar
- Adds an icon for the *Compare File with Next Revision* command (`gitlens.diffWithNext`) and moves it into the editor toolbar
@ -58,6 +61,7 @@
- Fixes [#366](https://github.com/eamodio/vscode-gitlens/issues/366) - Running a GitLens command from a keybinding fails
- Fixes [#155](https://github.com/eamodio/vscode-gitlens/issues/155) - Navigating file diffs with `alt+,` gets stuck
- Fixes [#359](https://github.com/eamodio/vscode-gitlens/issues/359) - Show changes of an added file in the first commit
- Fixes [#372](https://github.com/eamodio/vscode-gitlens/issues/372) - Wrong URL to VSTS work item when using hash work item id in commit
- Fixes *bronze* typo thanks to [PR #361](https://github.com/eamodio/vscode-gitlens/pull/361) by Cory Forsyth ([@bantic](https://github.com/bantic))
- Fixes *individually* typo thanks to [PR #364](https://github.com/eamodio/vscode-gitlens/pull/364) by Brett Cannon ([@brettcannon](https://github.com/brettcannon))
- Fixes issue where comparing previous revision during a merge/rebase conflict failed to show the correct contents
@ -615,6 +619,7 @@ See also [Explorer Settings](#explorer-settings "Jump to the Explorer settings")
|`gitlens.gitExplorer.files.layout`|Specifies how the *GitLens* explorer will display files<br /> `auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.gitExplorer.files.threshold` setting and the number of files at each nesting level<br /> `list` - displays files as a list<br /> `tree` - displays files as a tree
|`gitlens.gitExplorer.files.threshold`|Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the *GitLens* explorer<br />Only applies when displaying files as `auto`
|`gitlens.gitExplorer.includeWorkingTree`|Specifies whether to include working tree files inside the `Repository Status` node of the *GitLens* explorer
|`gitlens.gitExplorer.location`|Specifies where to show the `GitLens` explorer<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view
|`gitlens.gitExplorer.showTrackingBranch`|Specifies whether to show the tracking branch when displaying local branches in the *GitLens* explorer"
|`gitlens.gitExplorer.view`|Specifies the starting view of the *GitLens* explorer<br /> `auto` - shows the last selected view, defaults to `repository`<br />`history` - shows the commit history of the current file<br />`repository` - shows a repository explorer"
@ -625,6 +630,7 @@ See also [Explorer Settings](#explorer-settings "Jump to the Explorer settings")
|Name | Description
|-----|------------
|`gitlens.historyExplorer.enabled`|Specifies whether to show the current file history undocked in a *GitLens History* explorer
|`gitlens.historyExplorer.location`|Specifies where to show the `GitLens History` explorer<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view
### GitLens Results View Settings
@ -635,6 +641,7 @@ See also [Explorer Settings](#explorer-settings "Jump to the Explorer settings")
|`gitlens.resultsExplorer.files.compact`|Specifies whether to compact (flatten) unnecessary file nesting in the *GitLens Results* view<br />Only applies when displaying files as a `tree` or `auto`
|`gitlens.resultsExplorer.files.layout`|Specifies how the *GitLens Results* view will display files<br /> `auto` - automatically switches between displaying files as a `tree` or `list` based on the `gitlens.resultsExplorer.files.threshold` setting and the number of files at each nesting level<br /> `list` - displays files as a list<br /> `tree` - displays files as a tree
|`gitlens.resultsExplorer.files.threshold`|Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the *GitLens Results* view<br />Only applies when displaying files as `auto`
|`gitlens.resultsExplorer.location`|Specifies where to show the `GitLens Results` view<br />`explorer` - adds to the Explorer view<br />`scm` - adds to the Source Control view
### Explorer Settings

+ 50
- 3
package.json 查看文件

@ -464,6 +464,16 @@
"description": "Specifies whether to include working tree files inside the `Repository Status` node of the `GitLens` explorer",
"scope": "window"
},
"gitlens.gitExplorer.location": {
"type": "string",
"default": "scm",
"enum": [
"explorer",
"scm"
],
"description": "Specifies where to show the `GitLens` explorer\n `explorer` - adds to the Explorer view\n `scm` - adds to the Source Control view",
"scope": "window"
},
"gitlens.gitExplorer.showTrackingBranch": {
"type": "boolean",
"default": true,
@ -497,6 +507,16 @@
"description": "Specifies whether to show the current file history undocked in a `GitLens History` explorer",
"scope": "window"
},
"gitlens.historyExplorer.location": {
"type": "string",
"default": "explorer",
"enum": [
"explorer",
"scm"
],
"description": "Specifies where to show the `GitLens History` explorer\n `explorer` - adds to the Explorer view\n `scm` - adds to the Source Control view",
"scope": "window"
},
"gitlens.hovers.annotations.changes": {
"type": "boolean",
"default": true,
@ -925,6 +945,16 @@
"description": "Specifies when to switch between displaying files as a `tree` or `list` based on the number of files in a nesting level in the `GitLens Results` view\nOnly applies when displaying files as `auto`",
"scope": "window"
},
"gitlens.resultsExplorer.location": {
"type": "string",
"default": "explorer",
"enum": [
"explorer",
"scm"
],
"description": "Specifies where to show the `GitLens Results` view\n `explorer` - adds to the Explorer view\n `scm` - adds to the Source Control view",
"scope": "window"
},
"gitlens.settings.mode": {
"type": "string",
"default": "simple",
@ -3120,21 +3150,38 @@
}
],
"views": {
"explorer": [
{
"id": "gitlens.gitExplorer",
"name": "GitLens",
"when": "gitlens:enabled && gitlens:gitExplorer == explorer"
},
{
"id": "gitlens.historyExplorer",
"name": "GitLens History",
"when": "gitlens:enabled && gitlens:historyExplorer == explorer"
},
{
"id": "gitlens.resultsExplorer",
"name": "GitLens Results",
"when": "gitlens:enabled && gitlens:resultsExplorer == explorer"
}
],
"scm": [
{
"id": "gitlens.gitExplorer",
"name": "GitLens",
"when": "gitlens:enabled && gitlens:gitExplorer"
"when": "gitlens:enabled && gitlens:gitExplorer == scm"
},
{
"id": "gitlens.historyExplorer",
"name": "GitLens History",
"when": "gitlens:enabled && gitlens:historyExplorer"
"when": "gitlens:enabled && gitlens:historyExplorer == scm"
},
{
"id": "gitlens.resultsExplorer",
"name": "GitLens Results",
"when": "gitlens:enabled && gitlens:resultsExplorer"
"when": "gitlens:enabled && gitlens:resultsExplorer == scm"
}
]
}

+ 3
- 0
src/ui/config.ts 查看文件

@ -190,12 +190,14 @@ export interface IGitExplorerConfig {
enabled: boolean;
files: IExplorersFilesConfig;
includeWorkingTree: boolean;
location: 'explorer' | 'scm';
showTrackingBranch: boolean;
view: GitExplorerView;
}
export interface IHistoryExplorerConfig {
enabled: boolean;
location: 'explorer' | 'scm';
}
export interface IMenuConfig {
@ -236,6 +238,7 @@ export interface IModeConfig {
export interface IResultsExplorerConfig {
files: IExplorersFilesConfig;
location: 'explorer' | 'scm';
}
export interface IRemotesConfig {

+ 29
- 5
src/ui/settings/index.html 查看文件

@ -254,6 +254,14 @@
<label for="gitExplorer.enabled">Show the GitLens explorer</label>
</div>
<div class="settings-group__setting ml-2" data-enablement="gitExplorer.enabled">
<label for="gitExplorer.location">Show in the</label>
<select class="setting" id="gitExplorer.location" name="gitExplorer.location" disabled>
<option value="explorer">Explorer view</option>
<option value="scm">Source Control view</option>
</select>
</div>
<div class="settings-group__setting ml-2" data-enablement="gitExplorer.enabled &amp; historyExplorer.enabled =false">
<label for="gitExplorer.view">When opened, show the</label>
<select class="setting hidden" id="gitExplorer.view" name="gitExplorer.view" data-visibility="historyExplorer.enabled =false" disabled>
@ -343,6 +351,14 @@
</div>
<p class="setting__hint hidden" data-visibility="gitExplorer.enabled &amp; historyExplorer.enabled =false">The current file history will be shown (docked) in the GitLens explorer</p>
<div class="settings-group__setting ml-2" data-enablement="historyExplorer.enabled">
<label for="historyExplorer.location">Show in the</label>
<select class="setting" id="historyExplorer.location" name="historyExplorer.location" disabled>
<option value="explorer">Explorer view</option>
<option value="scm">Source Control view</option>
</select>
</div>
<div class="settings-group__setting nowrap ml-2 hidden" data-enablement="historyExplorer.enabled" data-visibility="settings.mode =advanced">
<input class="setting" id="historyExplorer.avatars" name="explorers.avatars" type="checkbox" disabled/>
<label for="historyExplorer.avatars">Use author avatars icons</label>
@ -359,7 +375,7 @@
</div>
</section>
<section id="gitlens-results" class="hidden" data-visibility="settings.mode =advanced">
<section id="gitlens-results">
<div class="section__header">
<h2 class="section__title">GitLens Results
<a class="link__learn-more" title="Learn more" href="https://github.com/eamodio/vscode-gitlens/#gitlens-results-view">
@ -371,6 +387,14 @@
<div class="section__settings">
<div class="settings-group">
<div class="settings-group__setting">
<label for="resultsExplorer.location">Show in the</label>
<select class="setting" id="resultsExplorer.location" name="resultsExplorer.location">
<option value="explorer">Explorer view</option>
<option value="scm">Source Control view</option>
</select>
</div>
<div class="settings-group__setting hidden" data-visibility="settings.mode =advanced">
<label for="resultsExplorer.files.layout">Layout files</label>
<select class="setting" id="resultsExplorer.files.layout" name="resultsExplorer.files.layout">
<option value="auto">automatically</option>
@ -379,13 +403,13 @@
</select>
</div>
<div class="settings-group__setting nowrap">
<div class="settings-group__setting nowrap hidden" data-visibility="settings.mode =advanced">
<input class="setting" id="resultsExplorer.files.compact" name="resultsExplorer.files.compact" type="checkbox"/>
<label for="resultsExplorer.files.compact">Use compact layout</label>
</div>
<p class="setting__hint">Compacts (flattens) unnecessary nesting when using a tree layouts</p>
<p class="setting__hint hidden" data-visibility="settings.mode =advanced">Compacts (flattens) unnecessary nesting when using a tree layouts</p>
<div class="settings-group__setting nowrap">
<div class="settings-group__setting nowrap hidden" data-visibility="settings.mode =advanced">
<input class="setting" id="resultsExplorer.avatars" name="explorers.avatars" type="checkbox"/>
<label for="resultsExplorer.avatars">Use author avatars icons</label>
</div>
@ -1034,7 +1058,7 @@
<li><a class="jump-to" href="#general">General</a></li>
<li><a class="jump-to" href="#gitlens-explorer">GitLens Explorer</a></li>
<li><a class="jump-to" href="#gitlens-history-explorer">GitLens History Explorer</a></li>
<li><a class="jump-to" href="#gitlens-results" class="hidden" data-visibility="settings.mode =advanced">GitLens Results</a></li>
<li><a class="jump-to" href="#gitlens-results">GitLens Results</a></li>
<li><a class="jump-to" href="#code-lens">Code Lens</a></li>
<li><a class="jump-to" href="#current-line">Current Line Blame</a></li>
<li><a class="jump-to" href="#blame">Gutter Blame</a></li>

+ 5
- 1
src/ui/welcome/index.html 查看文件

@ -46,7 +46,7 @@
<div class="changelog__details"></div>
</li>
<li><span class="changelog__badge changelog__badge--added">NEW</span>
Moves the <i>GitLens</i>, <i>GitLens History</i>, and <i>GitLens Results</i> explorers under the Source Control activity (in the sidebar) 🎉 &mdash; closes <a title="Open Issue #213" href="https://github.com/eamodio/vscode-gitlens/issues/213">#213</a>
Adds the ability to control where the <i>GitLens</i>, <i>GitLens History</i>, and <i>GitLens Results</i> explorers are shown 🎉 &mdash; closes <a title="Open Issue #213" href="https://github.com/eamodio/vscode-gitlens/issues/213">#213</a>, <a title="Open Issue #377" href="https://github.com/eamodio/vscode-gitlens/issues/377">#377</a>
<div class="changelog__details"></div>
</li>
<li><span class="changelog__badge changelog__badge--added">NEW</span>
@ -150,6 +150,10 @@
<div class="changelog__details"></div>
</li>
<li><span class="changelog__badge changelog__badge--fixed">FIXED</span>
Fixes <a title="Open Issue #372" href="https://github.com/eamodio/vscode-gitlens/issues/372">#372</a> &mdash; Wrong URL to VSTS work item when using hash work item id in commit
<div class="changelog__details"></div>
</li>
<li><span class="changelog__badge changelog__badge--fixed">FIXED</span>
Fixes <i>bronze</i> typo thanks to <a title="Pull Request #361" href="https://github.com/eamodio/vscode-gitlens/pull/361">PR #361</a> by Cory Forsyth (<a title="Cory Forsyth" href="https://github.com/bantic">@bantic</a>)
<div class="changelog__details"></div>
</li>

+ 4
- 2
src/views/gitExplorer.ts 查看文件

@ -73,8 +73,10 @@ export class GitExplorer extends Disposable implements TreeDataProvider
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value) &&
!configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value)) return;
if (initializing || configuration.changed(e, configuration.name('gitExplorer')('enabled').value)) {
setCommandContext(CommandContext.GitExplorer, this.config.enabled);
if (initializing ||
configuration.changed(e, configuration.name('gitExplorer')('enabled').value) ||
configuration.changed(e, configuration.name('gitExplorer')('location').value)) {
setCommandContext(CommandContext.GitExplorer, this.config.enabled ? this.config.location : false);
}
if (initializing || configuration.changed(e, configuration.name('gitExplorer')('autoRefresh').value)) {

+ 11
- 5
src/views/historyExplorer.ts 查看文件

@ -1,7 +1,7 @@
'use strict';
import { Functions } from '../system';
import { commands, ConfigurationChangeEvent, Disposable, Event, EventEmitter, TextEditor, TreeDataProvider, TreeItem, TreeView, window } from 'vscode';
import { configuration, GitExplorerView, IExplorersConfig } from '../configuration';
import { configuration, GitExplorerView, IExplorersConfig, IHistoryExplorerConfig } from '../configuration';
import { CommandContext, GlyphChars, setCommandContext } from '../constants';
import { Container } from '../container';
import { RefreshNodeCommandArgs } from './explorerCommands';
@ -56,7 +56,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
!configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value)) return;
if (initializing || configuration.changed(e, configuration.name('historyExplorer')('enabled').value)) {
if (Container.config.historyExplorer.enabled) {
if (this.config.enabled) {
this.undock(!initializing, !configuration.changed(e, configuration.name('mode').value));
}
else {
@ -64,6 +64,10 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
}
}
if (!initializing && configuration.changed(e, configuration.name('historyExplorer')('location').value) && this.config.enabled) {
setCommandContext(CommandContext.HistoryExplorer, this.config.location);
}
if (!initializing && this._root === undefined) {
this.refresh(RefreshReason.ConfigurationChanged);
}
@ -94,8 +98,8 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
}
}
get config(): IExplorersConfig {
return { ...Container.config.explorers };
get config(): IExplorersConfig & IHistoryExplorerConfig {
return { ...Container.config.explorers, ...Container.config.historyExplorer };
}
getParent(element: ExplorerNode): ExplorerNode | undefined {
@ -117,6 +121,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
if (switchView) {
await Container.gitExplorer.switchTo(GitExplorerView.History);
}
await setCommandContext(CommandContext.HistoryExplorer, false);
if (updateConfig) {
await configuration.updateEffective(configuration.name('historyExplorer')('enabled').value, false);
@ -169,7 +174,8 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
if (switchView) {
await Container.gitExplorer.switchTo(GitExplorerView.Repository);
}
await setCommandContext(CommandContext.HistoryExplorer, true);
await setCommandContext(CommandContext.HistoryExplorer, this.config.location);
if (updateConfig) {
await configuration.updateEffective(configuration.name('historyExplorer')('enabled').value, true);
}

+ 13
- 1
src/views/resultsExplorer.ts 查看文件

@ -59,6 +59,10 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
!configuration.changed(e, configuration.name('explorers').value) &&
!configuration.changed(e, configuration.name('defaultGravatarsStyle').value)) return;
if (!initializing && configuration.changed(e, configuration.name('resultsExplorer')('location').value) && this.enabled) {
setCommandContext(CommandContext.ResultsExplorer, this.config.location);
}
if (!initializing && this._roots.length !== 0) {
this.refresh(RefreshReason.ConfigurationChanged);
}
@ -73,12 +77,19 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
return { ...Container.config.explorers, ...Container.config.resultsExplorer };
}
private _enabled: boolean = false;
get enabled(): boolean {
return this._enabled;
}
get keepResults(): boolean {
return Container.context.workspaceState.get<boolean>(WorkspaceState.ResultsExplorerKeepResults, false);
}
close() {
this.clearResults();
this._enabled = false;
setCommandContext(CommandContext.ResultsExplorer, false);
}
@ -179,7 +190,8 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
}
private async showResults(results: ExplorerNode) {
await setCommandContext(CommandContext.ResultsExplorer, true);
this._enabled = true;
await setCommandContext(CommandContext.ResultsExplorer, this.config.location);
setTimeout(() => this._tree!.reveal(results, { select: true }), 250);
}

Loading…
取消
儲存