ソースを参照

Removes inheritance from Disposable

main
Eric Amodio 6年前
コミット
1f657bbbb3
18個のファイルの変更20行の追加61行の削除
  1. +1
    -3
      src/annotations/annotationProvider.ts
  2. +1
    -3
      src/annotations/fileAnnotationController.ts
  3. +1
    -3
      src/annotations/lineAnnotationController.ts
  4. +1
    -3
      src/codelens/codeLensController.ts
  5. +2
    -6
      src/commands/common.ts
  6. +1
    -3
      src/git/models/repository.ts
  7. +1
    -3
      src/gitService.ts
  8. +1
    -3
      src/hovers/lineHoverController.ts
  9. +2
    -6
      src/keyboard.ts
  10. +1
    -3
      src/statusbar/statusBarController.ts
  11. +1
    -3
      src/trackers/activeEditorTracker.ts
  12. +1
    -3
      src/trackers/documentTracker.ts
  13. +1
    -5
      src/trackers/lineTracker.ts
  14. +1
    -3
      src/trackers/trackedDocument.ts
  15. +1
    -3
      src/views/explorerCommands.ts
  16. +1
    -2
      src/views/nodes/explorerNode.ts
  17. +1
    -3
      src/views/resultsExplorer.ts
  18. +1
    -3
      src/webviews/webviewEditor.ts

+ 1
- 3
src/annotations/annotationProvider.ts ファイルの表示

@ -23,7 +23,7 @@ export enum AnnotationStatus {
export type TextEditorCorrelationKey = string;
export abstract class AnnotationProviderBase extends Disposable {
export abstract class AnnotationProviderBase implements Disposable {
static getCorrelationKey(editor: TextEditor | undefined): TextEditorCorrelationKey {
return editor !== undefined ? (editor as any).id : '';
}
@ -42,8 +42,6 @@ export abstract class AnnotationProviderBase extends Disposable {
protected decoration: TextEditorDecorationType,
protected highlightDecoration: TextEditorDecorationType | undefined
) {
super(() => this.dispose());
this.correlationKey = AnnotationProviderBase.getCorrelationKey(this.editor);
this.document = this.editor.document;

+ 1
- 3
src/annotations/fileAnnotationController.ts ファイルの表示

@ -55,7 +55,7 @@ export const Decorations = {
recentChangesHighlight: undefined as TextEditorDecorationType | undefined
};
export class FileAnnotationController extends Disposable {
export class FileAnnotationController implements Disposable {
private _onDidToggleAnnotations = new EventEmitter<void>();
get onDidToggleAnnotations(): Event<void> {
return this._onDidToggleAnnotations.event;
@ -70,8 +70,6 @@ export class FileAnnotationController extends Disposable {
private _annotationType: FileAnnotationType | undefined = undefined;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(configuration.onDidChange(this.onConfigurationChanged, this));
this._toggleModes = new Map();

+ 1
- 3
src/annotations/lineAnnotationController.ts ファイルの表示

@ -24,15 +24,13 @@ const annotationDecoration: TextEditorDecorationType = window.createTextEditorDe
rangeBehavior: DecorationRangeBehavior.ClosedOpen
} as DecorationRenderOptions);
export class LineAnnotationController extends Disposable {
export class LineAnnotationController implements Disposable {
private _disposable: Disposable;
private _debugSessionEndDisposable: Disposable | undefined;
private _editor: TextEditor | undefined;
private _enabled: boolean = false;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
Container.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled, this),

+ 1
- 3
src/codelens/codeLensController.ts ファイルの表示

@ -11,15 +11,13 @@ import {
} from '../trackers/gitDocumentTracker';
import { GitCodeLensProvider } from './gitCodeLensProvider';
export class CodeLensController extends Disposable {
export class CodeLensController implements Disposable {
private _canToggle: boolean = false;
private _disposable: Disposable | undefined;
private _provider: GitCodeLensProvider | undefined;
private _providerDisposable: Disposable | undefined;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(configuration.onDidChange(this.onConfigurationChanged, this));
this.onConfigurationChanged(configuration.initializingChangeEvent);
}

+ 2
- 6
src/commands/common.ts ファイルの表示

@ -213,7 +213,7 @@ function isTextEditor(editor: any): editor is TextEditor {
);
}
export abstract class Command extends Disposable {
export abstract class Command implements Disposable {
static getMarkdownCommandArgsCore<T>(command: Commands, args: T): string {
return `command:${command}?${encodeURIComponent(JSON.stringify(args))}`;
}
@ -223,8 +223,6 @@ export abstract class Command extends Disposable {
private _disposable: Disposable;
constructor(command: Commands | Commands[]) {
super(() => this.dispose());
if (typeof command === 'string') {
this._disposable = commands.registerCommand(
command,
@ -354,12 +352,10 @@ export abstract class ActiveEditorCachedCommand extends ActiveEditorCommand {
abstract execute(editor: TextEditor, ...args: any[]): any;
}
export abstract class EditorCommand extends Disposable {
export abstract class EditorCommand implements Disposable {
private _disposable: Disposable;
constructor(command: Commands | Commands[]) {
super(() => this.dispose());
if (!Array.isArray(command)) {
command = [command];
}

+ 1
- 3
src/git/models/repository.ts ファイルの表示

@ -59,7 +59,7 @@ export enum RepositoryStorage {
StatusNode = 'statusNode'
}
export class Repository extends Disposable {
export class Repository implements Disposable {
private _onDidChange = new EventEmitter<RepositoryChangeEvent>();
get onDidChange(): Event<RepositoryChangeEvent> {
return this._onDidChange.event;
@ -95,8 +95,6 @@ export class Repository extends Disposable {
suspended: boolean,
closed: boolean = false
) {
super(() => this.dispose());
if (root) {
this.formattedName = folder.name;
}

+ 1
- 3
src/gitService.ts ファイルの表示

@ -78,7 +78,7 @@ export enum GitRepoSearchBy {
Sha = 'sha'
}
export class GitService extends Disposable {
export class GitService implements Disposable {
static emptyPromise: Promise<GitBlame | GitDiff | GitLog | undefined> = Promise.resolve(undefined);
static deletedSha = 'ffffffffffffffffffffffffffffffffffffffff';
static stagedUncommittedSha = Git.stagedUncommittedSha;
@ -97,8 +97,6 @@ export class GitService extends Disposable {
private _versionedUriCache: Map<string, GitUri>;
constructor() {
super(() => this.dispose());
this._repositoryTree = TernarySearchTree.forPaths();
this._trackedCache = new Map();
this._versionedUriCache = new Map();

+ 1
- 3
src/hovers/lineHoverController.ts ファイルの表示

@ -18,14 +18,12 @@ import { configuration } from '../configuration';
import { Container } from '../container';
import { LinesChangeEvent } from '../trackers/gitLineTracker';
export class LineHoverController extends Disposable {
export class LineHoverController implements Disposable {
private _debugSessionEndDisposable: Disposable | undefined;
private _disposable: Disposable;
private _hoverProviderDisposable: Disposable | undefined;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
debug.onDidStartDebugSession(this.onDebugSessionStarted, this)

+ 2
- 6
src/keyboard.ts ファイルの表示

@ -19,12 +19,10 @@ export declare interface KeyMapping {
const mappings: KeyMapping[] = [];
export class KeyboardScope extends Disposable {
export class KeyboardScope implements Disposable {
constructor(
private readonly mapping: KeyMapping
) {
super(() => this.dispose());
for (const key in mapping) {
mapping[key] = mapping[key] || keyNoopCommand;
}
@ -81,12 +79,10 @@ export class KeyboardScope extends Disposable {
}
}
export class Keyboard extends Disposable {
export class Keyboard implements Disposable {
private _disposable: Disposable;
constructor() {
super(() => this.dispose());
const subscriptions = keys.map(key =>
commands.registerCommand(`${extensionId}.key.${key}`, () => this.execute(key), this)
);

+ 1
- 3
src/statusbar/statusBarController.ts ファイルの表示

@ -7,14 +7,12 @@ import { Container } from '../container';
import { CommitFormatter, GitCommit, ICommitFormatOptions } from '../gitService';
import { LinesChangeEvent } from '../trackers/gitLineTracker';
export class StatusBarController extends Disposable {
export class StatusBarController implements Disposable {
private _blameStatusBarItem: StatusBarItem | undefined;
private _disposable: Disposable;
private _modeStatusBarItem: StatusBarItem | undefined;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(configuration.onDidChange(this.onConfigurationChanged, this));
this.onConfigurationChanged(configuration.initializingChangeEvent);
}

+ 1
- 3
src/trackers/activeEditorTracker.ts ファイルの表示

@ -3,13 +3,11 @@ import { commands, Disposable, TextEditor, window } from 'vscode';
import { BuiltInCommands } from '../constants';
import { Functions } from '../system';
export class ActiveEditorTracker extends Disposable {
export class ActiveEditorTracker implements Disposable {
private _disposable: Disposable;
private _resolver: ((editor: TextEditor | undefined) => void) | undefined;
constructor() {
super(() => this.dispose());
const fn = Functions.debounce((e: TextEditor | undefined) => this._resolver && this._resolver(e), 50);
this._disposable = window.onDidChangeActiveTextEditor(fn);
}

+ 1
- 3
src/trackers/documentTracker.ts ファイルの表示

@ -34,7 +34,7 @@ export interface DocumentDirtyIdleTriggerEvent {
readonly document: TrackedDocument<T>;
}
export class DocumentTracker<T> extends Disposable {
export class DocumentTracker<T> implements Disposable {
private _onDidChangeBlameState = new EventEmitter<DocumentBlameStateChangeEvent<T>>();
get onDidChangeBlameState(): Event<DocumentBlameStateChangeEvent<T>> {
return this._onDidChangeBlameState.event;
@ -55,8 +55,6 @@ export class DocumentTracker extends Disposable {
private readonly _documentMap: Map<TextDocument | string, TrackedDocument<T>> = new Map();
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
window.onDidChangeActiveTextEditor(this.onActiveTextEditorChanged, this),

+ 1
- 5
src/trackers/lineTracker.ts ファイルの表示

@ -11,7 +11,7 @@ export interface LinesChangeEvent {
readonly pending?: boolean;
}
export class LineTracker<T> extends Disposable {
export class LineTracker<T> implements Disposable {
private _onDidChangeActiveLines = new EventEmitter<LinesChangeEvent>();
get onDidChangeActiveLines(): Event<LinesChangeEvent> {
return this._onDidChangeActiveLines.event;
@ -22,10 +22,6 @@ export class LineTracker extends Disposable {
private readonly _state: Map<number, T | undefined> = new Map();
constructor() {
super(() => this.dispose());
}
dispose() {
this.stop();
}

+ 1
- 3
src/trackers/trackedDocument.ts ファイルの表示

@ -12,7 +12,7 @@ export interface DocumentBlameStateChangeEvent {
readonly blameable: boolean;
}
export class TrackedDocument<T> extends Disposable {
export class TrackedDocument<T> implements Disposable {
private _onDidBlameStateChange = new EventEmitter<DocumentBlameStateChangeEvent<T>>();
get onDidBlameStateChange(): Event<DocumentBlameStateChangeEvent<T>> {
return this._onDidBlameStateChange.event;
@ -31,8 +31,6 @@ export class TrackedDocument extends Disposable {
public dirty: boolean,
private _eventDelegates: { onDidBlameStateChange(e: DocumentBlameStateChangeEvent<T>): void }
) {
super(() => this.dispose());
this._repo = this.initialize(_document.uri);
}

+ 1
- 3
src/views/explorerCommands.ts ファイルの表示

@ -41,14 +41,12 @@ interface ICompareSelected {
uri?: Uri;
}
export class ExplorerCommands extends Disposable {
export class ExplorerCommands implements Disposable {
private _disposable: Disposable | undefined;
private _terminal: Terminal | undefined;
private _terminalCwd: string | undefined;
constructor() {
super(() => this.dispose());
commands.registerCommand('gitlens.explorers.openChanges', this.openChanges, this);
commands.registerCommand('gitlens.explorers.openChangesWithWorking', this.openChangesWithWorking, this);
commands.registerCommand('gitlens.explorers.openFile', this.openFile, this);

+ 1
- 2
src/views/nodes/explorerNode.ts ファイルの表示

@ -66,7 +66,7 @@ export type Explorer = GitExplorer | HistoryExplorer | ResultsExplorer;
// let id = 0;
export abstract class ExplorerNode extends Disposable {
export abstract class ExplorerNode implements Disposable {
readonly supportsPaging: boolean = false;
maxCount: number | undefined;
@ -77,7 +77,6 @@ export abstract class ExplorerNode extends Disposable {
constructor(
public readonly uri: GitUri
) {
super(() => this.dispose());
// this.id = id++;
}

+ 1
- 3
src/views/resultsExplorer.ts ファイルの表示

@ -31,7 +31,7 @@ import {
export * from './nodes';
export class ResultsExplorer extends Disposable implements TreeDataProvider<ExplorerNode> {
export class ResultsExplorer implements TreeDataProvider<ExplorerNode>, Disposable {
private _disposable: Disposable | undefined;
private _roots: ExplorerNode[] = [];
private _tree: TreeView<ExplorerNode> | undefined;
@ -42,8 +42,6 @@ export class ResultsExplorer extends Disposable implements TreeDataProvider
}
constructor() {
super(() => this.dispose());
Container.explorerCommands;
commands.registerCommand('gitlens.resultsExplorer.refresh', this.refreshNodes, this);
commands.registerCommand('gitlens.resultsExplorer.refreshNode', this.refreshNode, this);

+ 1
- 3
src/webviews/webviewEditor.ts ファイルの表示

@ -16,14 +16,12 @@ import { Container } from '../container';
import { Logger } from '../logger';
import { Message, SettingsChangedMessage } from '../ui/ipc';
export abstract class WebviewEditor<TBootstrap> extends Disposable {
export abstract class WebviewEditor<TBootstrap> implements Disposable {
private _disposable: Disposable | undefined;
private _disposablePanel: Disposable | undefined;
private _panel: WebviewPanel | undefined;
constructor() {
super(() => this.dispose());
this._disposable = Disposable.from(
configuration.onDidChange(this.onConfigurationChanged, this),
...this.registerCommands()

読み込み中…
キャンセル
保存