From f2aab9968c199ad636863900ebaa110bcdfd18d9 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 11 Sep 2018 00:39:05 -0400 Subject: [PATCH] Shows explorer when adding revision workspace folder --- .vscode/settings.json | 5 ++++- src/commands/common.ts | 7 +++++-- src/constants.ts | 2 ++ src/views/explorerCommands.ts | 5 +++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5e5728e..6d15358 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,8 @@ "unspecified-properties-position": "bottom" }, "prettier.requireConfig": true, - "prettier.tslintIntegration": true + "prettier.tslintIntegration": true, + "search.exclude": { + "**/dist": true + } } diff --git a/src/commands/common.ts b/src/commands/common.ts index b2b3c80..595976f 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -434,6 +434,9 @@ export function openWorkspace(uri: Uri, name: string, options: { openInNewWindow return true; } - const count = (workspace.workspaceFolders && workspace.workspaceFolders.length) || 0; - return workspace.updateWorkspaceFolders(count, 0, { uri, name }); + return workspace.updateWorkspaceFolders( + workspace.workspaceFolders !== undefined ? workspace.workspaceFolders.length : 0, + null, + { uri, name } + ); } diff --git a/src/constants.ts b/src/constants.ts index df61cee..89e38a6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -15,12 +15,14 @@ export enum BuiltInCommands { EditorScroll = 'editorScroll', ExecuteDocumentSymbolProvider = 'vscode.executeDocumentSymbolProvider', ExecuteCodeLensProvider = 'vscode.executeCodeLensProvider', + FocusFilesExplorer = 'workbench.files.action.focusFilesExplorer', Open = 'vscode.open', OpenFolder = 'vscode.openFolder', NextEditor = 'workbench.action.nextEditor', PreviewHtml = 'vscode.previewHtml', RevealLine = 'revealLine', SetContext = 'setContext', + ShowExplorerActivity = 'workbench.view.explorer', ShowReferences = 'editor.action.showReferences' } diff --git a/src/views/explorerCommands.ts b/src/views/explorerCommands.ts index 416f17f..de38b7c 100644 --- a/src/views/explorerCommands.ts +++ b/src/views/explorerCommands.ts @@ -12,7 +12,7 @@ import { OpenFileRevisionCommandArgs, openWorkspace } from '../commands'; -import { CommandContext, extensionTerminalName, setCommandContext } from '../constants'; +import { BuiltInCommands, CommandContext, extensionTerminalName, setCommandContext } from '../constants'; import { Container } from '../container'; import { toGitLensFSUri } from '../git/fsProvider'; import { GitService, GitUri } from '../git/gitService'; @@ -206,7 +206,6 @@ export class ExplorerCommands implements Disposable { repoPath: node.repoPath, uri: node instanceof CommitFileNode ? node.uri : undefined }; - setCommandContext(CommandContext.ExplorersCanCompare, true); } @@ -217,6 +216,8 @@ export class ExplorerCommands implements Disposable { const gitUri = GitUri.fromRevisionUri(uri); openWorkspace(uri, `${path.basename(gitUri.repoPath!)} @ ${gitUri.shortSha}`, options); + + void commands.executeCommand(BuiltInCommands.FocusFilesExplorer); } private openChanges(node: CommitNode | StashNode) {