mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
move autoRepositoryDetection implementation
This commit is contained in:
@@ -49,7 +49,7 @@
|
|||||||
"command.stashPopLatest": "Pop Latest Stash",
|
"command.stashPopLatest": "Pop Latest Stash",
|
||||||
"config.enabled": "Whether git is enabled",
|
"config.enabled": "Whether git is enabled",
|
||||||
"config.path": "Path to the git executable",
|
"config.path": "Path to the git executable",
|
||||||
"config.autoRepositoryDetection": "Whether a repository should be automatically detected for a single file",
|
"config.autoRepositoryDetection": "Whether repositories should be automatically detected",
|
||||||
"config.autorefresh": "Whether auto refreshing is enabled",
|
"config.autorefresh": "Whether auto refreshing is enabled",
|
||||||
"config.autofetch": "Whether auto fetching is enabled",
|
"config.autofetch": "Whether auto fetching is enabled",
|
||||||
"config.enableLongCommitWarning": "Whether long commit messages should be warned about",
|
"config.enableLongCommitWarning": "Whether long commit messages should be warned about",
|
||||||
|
|||||||
@@ -149,6 +149,13 @@ export class Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onDidChangeVisibleTextEditors(editors: TextEditor[]): void {
|
private onDidChangeVisibleTextEditors(editors: TextEditor[]): void {
|
||||||
|
const config = workspace.getConfiguration('git');
|
||||||
|
const enabled = config.get<boolean>('autoRepositoryDetection') === true;
|
||||||
|
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
editors.forEach(editor => {
|
editors.forEach(editor => {
|
||||||
const uri = editor.document.uri;
|
const uri = editor.document.uri;
|
||||||
|
|
||||||
|
|||||||
@@ -904,18 +904,9 @@ export class Repository implements Disposable {
|
|||||||
const index: Resource[] = [];
|
const index: Resource[] = [];
|
||||||
const workingTree: Resource[] = [];
|
const workingTree: Resource[] = [];
|
||||||
const merge: Resource[] = [];
|
const merge: Resource[] = [];
|
||||||
const repoDetection = config.get<boolean>('autoRepositoryDetection') === true;
|
|
||||||
|
|
||||||
status.forEach(raw => {
|
status.forEach(raw => {
|
||||||
const fullFilePath = path.join(this.repository.root, raw.path);
|
const uri = Uri.file(path.join(this.repository.root, raw.path));
|
||||||
|
|
||||||
if (!repoDetection && workspace.workspaceFolders === undefined) {
|
|
||||||
if (!this.detectActiveFile(fullFilePath)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const uri = Uri.file(fullFilePath);
|
|
||||||
const renameUri = raw.rename ? Uri.file(path.join(this.repository.root, raw.rename)) : undefined;
|
const renameUri = raw.rename ? Uri.file(path.join(this.repository.root, raw.rename)) : undefined;
|
||||||
|
|
||||||
switch (raw.x + raw.y) {
|
switch (raw.x + raw.y) {
|
||||||
@@ -973,10 +964,6 @@ export class Repository implements Disposable {
|
|||||||
this._onDidChangeStatus.fire();
|
this._onDidChangeStatus.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private detectActiveFile(fullFilePath: string): boolean | undefined {
|
|
||||||
return window.activeTextEditor && window.activeTextEditor.document.fileName === fullFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private onFSChange(uri: Uri): void {
|
private onFSChange(uri: Uri): void {
|
||||||
const config = workspace.getConfiguration('git');
|
const config = workspace.getConfiguration('git');
|
||||||
const autorefresh = config.get<boolean>('autorefresh');
|
const autorefresh = config.get<boolean>('autorefresh');
|
||||||
|
|||||||
Reference in New Issue
Block a user