Browse Source

Fixes #397 - Error while opening views using `Open View` command

main
Eric Amodio 6 years ago
parent
commit
b208e51ebf
5 changed files with 80 additions and 58 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +34
    -34
      package.json
  3. +15
    -8
      src/views/gitExplorer.ts
  4. +18
    -9
      src/views/historyExplorer.ts
  5. +12
    -7
      src/views/resultsExplorer.ts

+ 1
- 0
CHANGELOG.md View File

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds clipboard support for Linux without requiring any external dependencies — thanks to [PR #394](https://github.com/eamodio/vscode-gitlens/pull/394) by Cédric Malard ([@cmalard](https://github.com/cmalard))
### Fixed
- Fixes [#397](https://github.com/eamodio/vscode-gitlens/issues/397) - Error while opening the gitlens view using `Open View` command
- Fixes [#391](https://github.com/eamodio/vscode-gitlens/issues/391) - GitLens adds some settings in settings.json
- Fixes another case of [#343](https://github.com/eamodio/vscode-gitlens/issues/343) - Can't show blame when VSCode starts on branch without upstream — thanks to [PR #390](https://github.com/eamodio/vscode-gitlens/pull/390) by ryenus ([@ryenus](https://github.com/ryenus))
- Fixes [#392](https://github.com/eamodio/vscode-gitlens/issues/392) - unable to contribute if default script shell is sh — thanks to [PR #393](https://github.com/eamodio/vscode-gitlens/pull/393) by Cédric Malard ([@cmalard](https://github.com/cmalard))

+ 34
- 34
package.json View File

@ -2560,127 +2560,127 @@
"view/title": [
{
"command": "gitlens.showCommitSearch",
"when": "view == gitlens.gitExplorer",
"when": "view =~ /^gitlens.gitExplorer:/",
"group": "navigation@1"
},
{
"command": "gitlens.gitExplorer.undockHistory",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history && !gitlens:historyExplorer",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == history && !gitlens:historyExplorer",
"group": "navigation@2"
},
{
"command": "gitlens.gitExplorer.switchToHistoryView",
"when": "view == gitlens.gitExplorer && !gitlens:historyExplorer && gitlens:gitExplorer:view == repository",
"when": "view =~ /^gitlens.gitExplorer:/ && !gitlens:historyExplorer && gitlens:gitExplorer:view == repository",
"group": "navigation@3"
},
{
"command": "gitlens.gitExplorer.switchToRepositoryView",
"when": "view == gitlens.gitExplorer && !gitlens:historyExplorer && gitlens:gitExplorer:view == history",
"when": "view =~ /^gitlens.gitExplorer:/ && !gitlens:historyExplorer && gitlens:gitExplorer:view == history",
"group": "navigation@3"
},
{
"command": "gitlens.gitExplorer.refresh",
"when": "view == gitlens.gitExplorer",
"when": "view =~ /^gitlens.gitExplorer:/",
"group": "navigation@8"
},
{
"command": "gitlens.gitExplorer.setFilesLayoutToAuto",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == repository",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == repository",
"group": "1_gitlens"
},
{
"command": "gitlens.gitExplorer.setFilesLayoutToList",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == repository",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == repository",
"group": "1_gitlens"
},
{
"command": "gitlens.gitExplorer.setFilesLayoutToTree",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == repository",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == repository",
"group": "1_gitlens"
},
{
"command": "gitlens.gitExplorer.setAutoRefreshToOn",
"when": "view == gitlens.gitExplorer && config.gitlens.gitExplorer.autoRefresh && !gitlens:gitExplorer:autoRefresh",
"when": "view =~ /^gitlens.gitExplorer:/ && config.gitlens.gitExplorer.autoRefresh && !gitlens:gitExplorer:autoRefresh",
"group": "2_gitlens"
},
{
"command": "gitlens.gitExplorer.setAutoRefreshToOff",
"when": "view == gitlens.gitExplorer && config.gitlens.gitExplorer.autoRefresh && gitlens:gitExplorer:autoRefresh",
"when": "view =~ /^gitlens.gitExplorer:/ && config.gitlens.gitExplorer.autoRefresh && gitlens:gitExplorer:autoRefresh",
"group": "2_gitlens"
},
{
"command": "gitlens.gitExplorer.setRenameFollowingOn",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history && !config.gitlens.advanced.fileHistoryFollowsRenames",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == history && !config.gitlens.advanced.fileHistoryFollowsRenames",
"group": "2_gitlens_1"
},
{
"command": "gitlens.gitExplorer.setRenameFollowingOff",
"when": "view == gitlens.gitExplorer && gitlens:gitExplorer:view == history && config.gitlens.advanced.fileHistoryFollowsRenames",
"when": "view =~ /^gitlens.gitExplorer:/ && gitlens:gitExplorer:view == history && config.gitlens.advanced.fileHistoryFollowsRenames",
"group": "2_gitlens_1"
},
{
"command": "gitlens.historyExplorer.refresh",
"when": "view == gitlens.historyExplorer",
"when": "view =~ /^gitlens.historyExplorer:/",
"group": "navigation@1"
},
{
"command": "gitlens.historyExplorer.dock",
"when": "view == gitlens.historyExplorer && gitlens:gitExplorer",
"when": "view =~ /^gitlens.historyExplorer:/ && gitlens:gitExplorer",
"group": "navigation@9"
},
{
"command": "gitlens.historyExplorer.close",
"when": "view == gitlens.historyExplorer && !gitlens:gitExplorer",
"when": "view =~ /^gitlens.historyExplorer:/ && !gitlens:gitExplorer",
"group": "navigation@9"
},
{
"command": "gitlens.historyExplorer.setRenameFollowingOn",
"when": "view == gitlens.historyExplorer && !config.gitlens.advanced.fileHistoryFollowsRenames",
"when": "view =~ /^gitlens.historyExplorer:/ && !config.gitlens.advanced.fileHistoryFollowsRenames",
"group": "1_gitlens"
},
{
"command": "gitlens.historyExplorer.setRenameFollowingOff",
"when": "view == gitlens.historyExplorer && config.gitlens.advanced.fileHistoryFollowsRenames",
"when": "view =~ /^gitlens.historyExplorer:/ && config.gitlens.advanced.fileHistoryFollowsRenames",
"group": "1_gitlens"
},
{
"command": "gitlens.showCommitSearch",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "navigation@1"
},
{
"command": "gitlens.resultsExplorer.setKeepResultsToOn",
"when": "view == gitlens.resultsExplorer && !gitlens:resultsExplorer:keepResults",
"when": "view =~ /^gitlens.resultsExplorer:/ && !gitlens:resultsExplorer:keepResults",
"group": "navigation@2"
},
{
"command": "gitlens.resultsExplorer.setKeepResultsToOff",
"when": "view == gitlens.resultsExplorer && gitlens:resultsExplorer:keepResults",
"when": "view =~ /^gitlens.resultsExplorer:/ && gitlens:resultsExplorer:keepResults",
"group": "navigation@2"
},
{
"command": "gitlens.resultsExplorer.refresh",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "navigation@3"
},
{
"command": "gitlens.resultsExplorer.close",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "navigation@9"
},
{
"command": "gitlens.resultsExplorer.setFilesLayoutToAuto",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "1_gitlens"
},
{
"command": "gitlens.resultsExplorer.setFilesLayoutToList",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "1_gitlens"
},
{
"command": "gitlens.resultsExplorer.setFilesLayoutToTree",
"when": "view == gitlens.resultsExplorer",
"when": "view =~ /^gitlens.resultsExplorer:/",
"group": "1_gitlens"
}
],
@ -2977,17 +2977,17 @@
},
{
"command": "gitlens.gitExplorer.refreshNode",
"when": "view == gitlens.gitExplorer && viewItem =~ /gitlens:(?!file\\b)/",
"when": "view =~ /^gitlens.gitExplorer:/ && viewItem =~ /gitlens:(?!file\\b)/",
"group": "9_gitlens@1"
},
{
"command": "gitlens.resultsExplorer.refreshNode",
"when": "view == gitlens.resultsExplorer && viewItem =~ /gitlens:(?!file\\b)/",
"when": "view =~ /^gitlens.resultsExplorer:/ && viewItem =~ /gitlens:(?!file\\b)/",
"group": "9_gitlens@1"
},
{
"command": "gitlens.historyExplorer.refreshNode",
"when": "view == gitlens.historyExplorer && viewItem =~ /gitlens:(?!file\\b)/",
"when": "view =~ /^gitlens.historyExplorer:/ && viewItem =~ /gitlens:(?!file\\b)/",
"group": "9_gitlens@1"
}
]
@ -3180,34 +3180,34 @@
"views": {
"explorer": [
{
"id": "gitlens.gitExplorer",
"id": "gitlens.gitExplorer:explorer",
"name": "GitLens",
"when": "gitlens:enabled && gitlens:gitExplorer == explorer"
},
{
"id": "gitlens.historyExplorer",
"id": "gitlens.historyExplorer:explorer",
"name": "GitLens History",
"when": "gitlens:enabled && gitlens:historyExplorer == explorer"
},
{
"id": "gitlens.resultsExplorer",
"id": "gitlens.resultsExplorer:explorer",
"name": "GitLens Results",
"when": "gitlens:enabled && gitlens:resultsExplorer == explorer"
}
],
"scm": [
{
"id": "gitlens.gitExplorer",
"id": "gitlens.gitExplorer:scm",
"name": "GitLens",
"when": "gitlens:enabled && gitlens:gitExplorer == scm"
},
{
"id": "gitlens.historyExplorer",
"id": "gitlens.historyExplorer:scm",
"name": "GitLens History",
"when": "gitlens:enabled && gitlens:historyExplorer == scm"
},
{
"id": "gitlens.resultsExplorer",
"id": "gitlens.resultsExplorer:scm",
"name": "GitLens Results",
"when": "gitlens:enabled && gitlens:resultsExplorer == scm"
}

+ 15
- 8
src/views/gitExplorer.ts View File

@ -99,18 +99,25 @@ export class GitExplorer extends Disposable implements TreeDataProvider
if (view === GitExplorerView.Auto) {
view = Container.context.workspaceState.get<GitExplorerView>(WorkspaceState.GitExplorerView, GitExplorerView.Repository);
}
}
if (initializing) {
this.view = view;
setCommandContext(CommandContext.GitExplorerView, this.view);
this.setRoot(await this.getRootNode(window.activeTextEditor));
if (initializing) {
this.view = view;
setCommandContext(CommandContext.GitExplorerView, this.view);
this._tree = window.createTreeView('gitlens.gitExplorer', { treeDataProvider: this });
this._disposable = this._tree;
this.setRoot(await this.getRootNode(window.activeTextEditor));
}
return;
if (initializing || configuration.changed(e, configuration.name('gitExplorer')('location').value)) {
if (this._disposable) {
this._disposable.dispose();
this._onDidChangeTreeData = new EventEmitter<ExplorerNode>();
}
this._tree = window.createTreeView(`gitlens.gitExplorer:${this.config.location}`, { treeDataProvider: this });
this._disposable = this._tree;
return;
}
this.reset(view!, configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value));

+ 18
- 9
src/views/historyExplorer.ts View File

@ -55,6 +55,12 @@ export class HistoryExplorer 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('historyExplorer')('enabled').value) ||
configuration.changed(e, configuration.name('historyExplorer')('location').value)) {
setCommandContext(CommandContext.HistoryExplorer, this.config.enabled ? this.config.location : false);
}
if (initializing || configuration.changed(e, configuration.name('historyExplorer')('enabled').value)) {
if (this.config.enabled) {
this.undock(!initializing, !configuration.changed(e, configuration.name('mode').value));
@ -64,20 +70,23 @@ 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);
}
if (initializing) {
this.setRoot(await this.getRootNode(window.activeTextEditor));
}
if (initializing || configuration.changed(e, configuration.name('historyExplorer')('location').value)) {
if (this._disposable) {
this._disposable.dispose();
this._onDidChangeTreeData = new EventEmitter<ExplorerNode>();
}
this._tree = window.createTreeView('gitlens.historyExplorer', { treeDataProvider: this });
this._tree = window.createTreeView(`gitlens.historyExplorer:${this.config.location}`, { treeDataProvider: this });
this._disposable = this._tree;
}
if (!initializing && this._root === undefined) {
this.refresh(RefreshReason.ConfigurationChanged);
}
}
private async onActiveEditorChanged(editor: TextEditor | undefined) {

+ 12
- 7
src/views/resultsExplorer.ts View File

@ -59,18 +59,23 @@ 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 || configuration.changed(e, configuration.name('resultsExplorer')('location').value)) {
setCommandContext(CommandContext.ResultsExplorer, this.enabled ? this.config.location : false);
}
if (!initializing && this._roots.length !== 0) {
this.refresh(RefreshReason.ConfigurationChanged);
}
if (initializing || configuration.changed(e, configuration.name('resultsExplorer')('location').value)) {
if (this._disposable) {
this._disposable.dispose();
this._onDidChangeTreeData = new EventEmitter<ExplorerNode>();
}
if (initializing) {
this._tree = window.createTreeView('gitlens.resultsExplorer', { treeDataProvider: this });
this._tree = window.createTreeView(`gitlens.resultsExplorer:${this.config.location}`, { treeDataProvider: this });
this._disposable = this._tree;
}
if (!initializing && this._roots.length !== 0) {
this.refresh(RefreshReason.ConfigurationChanged);
}
}
get config(): IExplorersConfig & IResultsExplorerConfig {

Loading…
Cancel
Save