Revert "Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)" (#5983)

This reverts commit d15a3fcc98.
This commit is contained in:
Karl Burtram
2019-06-11 12:35:58 -07:00
committed by GitHub
parent 95a50b7892
commit 5a7562a37b
926 changed files with 11394 additions and 19540 deletions

View File

@@ -38,8 +38,7 @@ import { ClassName } from 'vs/editor/common/model/intervalTree';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelLanguageConfigurationChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents';
import * as modes from 'vs/editor/common/modes';
import { editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity } from 'vs/editor/common/view/editorColorRegistry';
import { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorWarningBorder, editorWarningForeground } from 'vs/platform/theme/common/colorRegistry';
import { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity, editorWarningBorder, editorWarningForeground } from 'vs/editor/common/view/editorColorRegistry';
import { VerticalRevealType } from 'vs/editor/common/view/viewEvents';
import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer';
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';

View File

@@ -5,7 +5,7 @@
import * as assert from 'vs/base/common/assert';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
@@ -33,11 +33,12 @@ const defaultOptions: Options = {
/**
* Create a new diff navigator for the provided diff editor.
*/
export class DiffNavigator extends Disposable {
export class DiffNavigator {
private readonly _editor: IDiffEditor;
private readonly _options: Options;
private readonly _onDidUpdate = this._register(new Emitter<this>());
private readonly _disposables: IDisposable[];
private readonly _onDidUpdate = new Emitter<this>();
readonly onDidUpdate: Event<this> = this._onDidUpdate.event;
@@ -48,11 +49,11 @@ export class DiffNavigator extends Disposable {
private ignoreSelectionChange: boolean;
constructor(editor: IDiffEditor, options: Options = {}) {
super();
this._editor = editor;
this._options = objects.mixin(options, defaultOptions, false);
this.disposed = false;
this._disposables = [];
this.nextIdx = -1;
this.ranges = [];
@@ -60,11 +61,11 @@ export class DiffNavigator extends Disposable {
this.revealFirst = Boolean(this._options.alwaysRevealFirst);
// hook up to diff editor for diff, disposal, and caret move
this._register(this._editor.onDidDispose(() => this.dispose()));
this._register(this._editor.onDidUpdateDiff(() => this._onDiffUpdated()));
this._disposables.push(this._editor.onDidDispose(() => this.dispose()));
this._disposables.push(this._editor.onDidUpdateDiff(() => this._onDiffUpdated()));
if (this._options.followsCaret) {
this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
this._disposables.push(this._editor.getModifiedEditor().onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
if (this.ignoreSelectionChange) {
return;
}
@@ -72,7 +73,7 @@ export class DiffNavigator extends Disposable {
}));
}
if (this._options.alwaysRevealFirst) {
this._register(this._editor.getModifiedEditor().onDidChangeModel((e) => {
this._disposables.push(this._editor.getModifiedEditor().onDidChangeModel((e) => {
this.revealFirst = true;
}));
}
@@ -215,7 +216,9 @@ export class DiffNavigator extends Disposable {
}
dispose(): void {
super.dispose();
dispose(this._disposables);
this._disposables.length = 0;
this._onDidUpdate.dispose();
this.ranges = [];
this.disposed = true;
}