Ver a proveniência

Removes unneeded arrays

main
Eric Amodio há 7 anos
ascendente
cometimento
bfdcaad496
6 ficheiros alterados com 21 adições e 31 eliminações
  1. +4
    -7
      src/annotations/annotationController.ts
  2. +2
    -3
      src/annotations/annotationProvider.ts
  3. +2
    -3
      src/codeLensController.ts
  4. +4
    -6
      src/currentLineController.ts
  5. +3
    -4
      src/git/gitContextTracker.ts
  6. +6
    -8
      src/gitService.ts

+ 4
- 7
src/annotations/annotationController.ts Ver ficheiro

@ -66,10 +66,9 @@ export class AnnotationController extends Disposable {
this.onConfigurationChanged();
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this)
];
this._disposable = Disposable.from(...subscriptions);
);
}
dispose() {
@ -389,16 +388,14 @@ export class AnnotationController extends Disposable {
if (!this._annotationsDisposable && this._annotationProviders.size === 0) {
Logger.log(`Add listener registrations for annotations`);
const subscriptions: Disposable[] = [
this._annotationsDisposable = Disposable.from(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveTextEditorChanged, 50), this),
window.onDidChangeTextEditorViewColumn(this.onTextEditorViewColumnChanged, this),
window.onDidChangeVisibleTextEditors(this.onVisibleTextEditorsChanged, this),
workspace.onDidChangeTextDocument(Functions.debounce(this.onTextDocumentChanged, 50), this),
workspace.onDidCloseTextDocument(this.onTextDocumentClosed, this),
this.gitContextTracker.onDidChangeBlameability(this.onBlameabilityChanged, this)
];
this._annotationsDisposable = Disposable.from(...subscriptions);
);
}
this._annotationProviders.set(provider.correlationKey, provider);

+ 2
- 3
src/annotations/annotationProvider.ts Ver ficheiro

@ -33,10 +33,9 @@ export abstract class AnnotationProviderBase extends Disposable {
this._config = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
window.onDidChangeTextEditorSelection(this.onTextEditorSelectionChanged, this)
];
this._disposable = Disposable.from(...subscriptions);
);
}
async dispose() {

+ 2
- 3
src/codeLensController.ts Ver ficheiro

@ -23,11 +23,10 @@ export class CodeLensController extends Disposable {
this.onConfigurationChanged();
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
this.gitContextTracker.onDidChangeBlameability(this.onBlameabilityChanged, this)
];
this._disposable = Disposable.from(...subscriptions);
);
}
dispose() {

+ 4
- 6
src/currentLineController.ts Ver ficheiro

@ -51,12 +51,11 @@ export class CurrentLineController extends Disposable {
this.onConfigurationChanged();
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
annotationController.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)
];
this._disposable = Disposable.from(...subscriptions);
);
}
dispose() {
@ -116,12 +115,11 @@ export class CurrentLineController extends Disposable {
const trackCurrentLine = cfg.statusBar.enabled || cfg.blame.line.enabled || (this._blameLineAnnotationState !== undefined && this._blameLineAnnotationState.enabled);
if (trackCurrentLine && !this._trackCurrentLineDisposable) {
const subscriptions: Disposable[] = [
this._trackCurrentLineDisposable = Disposable.from(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveTextEditorChanged, 50), this),
window.onDidChangeTextEditorSelection(this.onTextEditorSelectionChanged, this),
this.gitContextTracker.onDidChangeBlameability(this.onBlameabilityChanged, this)
];
this._trackCurrentLineDisposable = Disposable.from(...subscriptions);
);
}
else if (!trackCurrentLine && this._trackCurrentLineDisposable) {
this._trackCurrentLineDisposable.dispose();

+ 3
- 4
src/git/gitContextTracker.ts Ver ficheiro

@ -53,14 +53,13 @@ export class GitContextTracker extends Disposable {
setCommandContext(CommandContext.Enabled, gitEnabled);
if (gitEnabled) {
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveTextEditorChanged, 50), this),
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
workspace.onDidChangeTextDocument(Functions.debounce(this.onTextDocumentChanged, 50), this),
this.git.onDidBlameFail(this.onBlameFailed, this),
this.git.onDidChangeRepo(this.onRepoChanged, this)
];
this._disposable = Disposable.from(...subscriptions);
this.git.onDidChange(this.onGitChanged, this)
);
this.updateContext(BlameabilityChangeReason.EditorChanged, window.activeTextEditor, true);
}

+ 6
- 8
src/gitService.ts Ver ficheiro

@ -117,13 +117,12 @@ export class GitService extends Disposable {
this.onConfigurationChanged();
this._repositoriesPromise = this.onWorkspaceFoldersChanged();
const subscriptions: Disposable[] = [
this._disposable = Disposable.from(
window.onDidChangeWindowState(this.onWindowStateChanged, this),
workspace.onDidChangeConfiguration(this.onConfigurationChanged, this),
workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged, this),
RemoteProviderFactory.onDidChange(this.onRemoteProviderChanged, this)
];
this._disposable = Disposable.from(...subscriptions);
RemoteProviderFactory.onDidChange(this.onRemoteProvidersChanged, this)
);
}
dispose() {
@ -162,11 +161,10 @@ export class GitService extends Disposable {
if (cfg.advanced.caching.enabled) {
this._cacheDisposable && this._cacheDisposable.dispose();
const subscriptions: Disposable[] = [
this._cacheDisposable = Disposable.from(
workspace.onDidChangeTextDocument(Functions.debounce(this.onTextDocumentChanged, 50), this),
workspace.onDidCloseTextDocument(this.onTextDocumentClosed, this)
];
this._cacheDisposable = Disposable.from(...subscriptions);
);
}
else {
this._cacheDisposable && this._cacheDisposable.dispose();
@ -190,7 +188,7 @@ export class GitService extends Disposable {
}
}
private onRemoteProviderChanged() {
private onRemoteProvidersChanged() {
this._remotesCache.clear();
this.fireRepoChange(RepoChangedReasons.Remotes);
}

Carregando…
Cancelar
Guardar