Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)

* Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d

* Fix vs unit tests and hygiene issue

* Fix strict null check issue
This commit is contained in:
Chris LaFreniere
2019-06-10 18:27:09 -07:00
committed by GitHub
parent ff38bc8143
commit d15a3fcc98
926 changed files with 19529 additions and 11383 deletions

View File

@@ -38,7 +38,8 @@ 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 { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity, editorWarningBorder, editorWarningForeground } from 'vs/editor/common/view/editorColorRegistry';
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 { 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 { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { Disposable } 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,12 +33,11 @@ const defaultOptions: Options = {
/**
* Create a new diff navigator for the provided diff editor.
*/
export class DiffNavigator {
export class DiffNavigator extends Disposable {
private readonly _editor: IDiffEditor;
private readonly _options: Options;
private readonly _disposables: IDisposable[];
private readonly _onDidUpdate = new Emitter<this>();
private readonly _onDidUpdate = this._register(new Emitter<this>());
readonly onDidUpdate: Event<this> = this._onDidUpdate.event;
@@ -49,11 +48,11 @@ export class DiffNavigator {
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 = [];
@@ -61,11 +60,11 @@ export class DiffNavigator {
this.revealFirst = Boolean(this._options.alwaysRevealFirst);
// hook up to diff editor for diff, disposal, and caret move
this._disposables.push(this._editor.onDidDispose(() => this.dispose()));
this._disposables.push(this._editor.onDidUpdateDiff(() => this._onDiffUpdated()));
this._register(this._editor.onDidDispose(() => this.dispose()));
this._register(this._editor.onDidUpdateDiff(() => this._onDiffUpdated()));
if (this._options.followsCaret) {
this._disposables.push(this._editor.getModifiedEditor().onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
this._register(this._editor.getModifiedEditor().onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {
if (this.ignoreSelectionChange) {
return;
}
@@ -73,7 +72,7 @@ export class DiffNavigator {
}));
}
if (this._options.alwaysRevealFirst) {
this._disposables.push(this._editor.getModifiedEditor().onDidChangeModel((e) => {
this._register(this._editor.getModifiedEditor().onDidChangeModel((e) => {
this.revealFirst = true;
}));
}
@@ -216,9 +215,7 @@ export class DiffNavigator {
}
dispose(): void {
dispose(this._disposables);
this._disposables.length = 0;
this._onDidUpdate.dispose();
super.dispose();
this.ranges = [];
this.disposed = true;
}