瀏覽代碼

Shows explorer when adding revision workspace folder

main
Eric Amodio 6 年之前
父節點
當前提交
f2aab9968c
共有 4 個檔案被更改,包括 14 行新增5 行删除
  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 查看文件

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

+ 5
- 2
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 }
);
}

+ 2
- 0
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'
}

+ 3
- 2
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) {

Loading…
取消
儲存