Browse Source

Shows explorer when adding revision workspace folder

main
Eric Amodio 6 years ago
parent
commit
f2aab9968c
4 changed files with 14 additions and 5 deletions
  1. +4
    -1
      .vscode/settings.json
  2. +5
    -2
      src/commands/common.ts
  3. +2
    -0
      src/constants.ts
  4. +3
    -2
      src/views/explorerCommands.ts

+ 4
- 1
.vscode/settings.json View File

@ -7,5 +7,8 @@
"unspecified-properties-position": "bottom" "unspecified-properties-position": "bottom"
}, },
"prettier.requireConfig": true, "prettier.requireConfig": true,
"prettier.tslintIntegration": true
"prettier.tslintIntegration": true,
"search.exclude": {
"**/dist": true
}
} }

+ 5
- 2
src/commands/common.ts View File

@ -434,6 +434,9 @@ export function openWorkspace(uri: Uri, name: string, options: { openInNewWindow
return true; 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 }
);
} }

+ 2
- 0
src/constants.ts View File

@ -15,12 +15,14 @@ export enum BuiltInCommands {
EditorScroll = 'editorScroll', EditorScroll = 'editorScroll',
ExecuteDocumentSymbolProvider = 'vscode.executeDocumentSymbolProvider', ExecuteDocumentSymbolProvider = 'vscode.executeDocumentSymbolProvider',
ExecuteCodeLensProvider = 'vscode.executeCodeLensProvider', ExecuteCodeLensProvider = 'vscode.executeCodeLensProvider',
FocusFilesExplorer = 'workbench.files.action.focusFilesExplorer',
Open = 'vscode.open', Open = 'vscode.open',
OpenFolder = 'vscode.openFolder', OpenFolder = 'vscode.openFolder',
NextEditor = 'workbench.action.nextEditor', NextEditor = 'workbench.action.nextEditor',
PreviewHtml = 'vscode.previewHtml', PreviewHtml = 'vscode.previewHtml',
RevealLine = 'revealLine', RevealLine = 'revealLine',
SetContext = 'setContext', SetContext = 'setContext',
ShowExplorerActivity = 'workbench.view.explorer',
ShowReferences = 'editor.action.showReferences' ShowReferences = 'editor.action.showReferences'
} }

+ 3
- 2
src/views/explorerCommands.ts View File

@ -12,7 +12,7 @@ import {
OpenFileRevisionCommandArgs, OpenFileRevisionCommandArgs,
openWorkspace openWorkspace
} from '../commands'; } from '../commands';
import { CommandContext, extensionTerminalName, setCommandContext } from '../constants';
import { BuiltInCommands, CommandContext, extensionTerminalName, setCommandContext } from '../constants';
import { Container } from '../container'; import { Container } from '../container';
import { toGitLensFSUri } from '../git/fsProvider'; import { toGitLensFSUri } from '../git/fsProvider';
import { GitService, GitUri } from '../git/gitService'; import { GitService, GitUri } from '../git/gitService';
@ -206,7 +206,6 @@ export class ExplorerCommands implements Disposable {
repoPath: node.repoPath, repoPath: node.repoPath,
uri: node instanceof CommitFileNode ? node.uri : undefined uri: node instanceof CommitFileNode ? node.uri : undefined
}; };
setCommandContext(CommandContext.ExplorersCanCompare, true); setCommandContext(CommandContext.ExplorersCanCompare, true);
} }
@ -217,6 +216,8 @@ export class ExplorerCommands implements Disposable {
const gitUri = GitUri.fromRevisionUri(uri); const gitUri = GitUri.fromRevisionUri(uri);
openWorkspace(uri, `${path.basename(gitUri.repoPath!)} @ ${gitUri.shortSha}`, options); openWorkspace(uri, `${path.basename(gitUri.repoPath!)} @ ${gitUri.shortSha}`, options);
void commands.executeCommand(BuiltInCommands.FocusFilesExplorer);
} }
private openChanges(node: CommitNode | StashNode) { private openChanges(node: CommitNode | StashNode) {

Loading…
Cancel
Save