Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)
* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 * disable strict null check
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
3
src/vs/editor/browser/widget/media/addition-dark.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14 7V8H8V14H7V8H1V7H7V1H8V7H14Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 163 B |
@@ -1 +0,0 @@
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="11" width="3" y="3" x="7" fill="#C5C5C5"/><rect height="3" width="11" y="7" x="3" fill="#C5C5C5"/></svg>
|
||||
|
Before Width: | Height: | Size: 203 B |
3
src/vs/editor/browser/widget/media/addition-light.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14 7V8H8V14H7V8H1V7H7V1H8V7H14Z" fill="#424242"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 163 B |
@@ -1 +0,0 @@
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="11" width="3" y="3" x="7" fill="#424242"/><rect height="3" width="11" y="7" x="3" fill="#424242"/></svg>
|
||||
|
Before Width: | Height: | Size: 203 B |
3
src/vs/editor/browser/widget/media/close-dark.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 8.70711L11.6465 12.3536L12.3536 11.6465L8.70711 8.00001L12.3536 4.35356L11.6465 3.64645L8.00001 7.2929L4.35356 3.64645L3.64645 4.35356L7.2929 8.00001L3.64645 11.6465L4.35356 12.3536L8.00001 8.70711Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#e8e8e8" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
|
||||
|
Before Width: | Height: | Size: 307 B |
3
src/vs/editor/browser/widget/media/close-light.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 8.70711L11.6465 12.3536L12.3536 11.6465L8.70711 8.00001L12.3536 4.35356L11.6465 3.64645L8.00001 7.2929L4.35356 3.64645L3.64645 4.35356L7.2929 8.00001L3.64645 11.6465L4.35356 12.3536L8.00001 8.70711Z" fill="#424242"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="3 3 16 16" enable-background="new 3 3 16 16"><polygon fill="#424242" points="12.597,11.042 15.4,13.845 13.844,15.4 11.042,12.598 8.239,15.4 6.683,13.845 9.485,11.042 6.683,8.239 8.238,6.683 11.042,9.486 13.845,6.683 15.4,8.239"/></svg>
|
||||
|
Before Width: | Height: | Size: 307 B |
3
src/vs/editor/browser/widget/media/deletion-dark.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15 8H1V7H15V8Z" fill="#C5C5C5"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 146 B |
@@ -1 +0,0 @@
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#C5C5C5"/></svg>
|
||||
|
Before Width: | Height: | Size: 147 B |
3
src/vs/editor/browser/widget/media/deletion-light.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15 8H1V7H15V8Z" fill="#424242"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 146 B |
@@ -1 +0,0 @@
|
||||
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><title>Layer 1</title><rect height="3" width="11" y="7" x="3" fill="#424242"/></svg>
|
||||
|
Before Width: | Height: | Size: 147 B |
@@ -40,8 +40,7 @@
|
||||
background-size: 60%;
|
||||
opacity: 0.7;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%;
|
||||
background-position: center;
|
||||
background-position: 75% center;
|
||||
background-size: 11px 11px;
|
||||
}
|
||||
.monaco-editor.hc-black .insert-sign,
|
||||
@@ -52,24 +51,24 @@
|
||||
}
|
||||
.monaco-editor .insert-sign,
|
||||
.monaco-diff-editor .insert-sign {
|
||||
background-image: url('addition.svg');
|
||||
background-image: url('addition-light.svg');
|
||||
}
|
||||
.monaco-editor .delete-sign,
|
||||
.monaco-diff-editor .delete-sign {
|
||||
background-image: url('deletion.svg');
|
||||
background-image: url('deletion-light.svg');
|
||||
}
|
||||
|
||||
.monaco-editor.vs-dark .insert-sign,
|
||||
.monaco-diff-editor.vs-dark .insert-sign,
|
||||
.monaco-editor.hc-black .insert-sign,
|
||||
.monaco-diff-editor.hc-black .insert-sign {
|
||||
background-image: url('addition-inverse.svg');
|
||||
background-image: url('addition-dark.svg');
|
||||
}
|
||||
.monaco-editor.vs-dark .delete-sign,
|
||||
.monaco-diff-editor.vs-dark .delete-sign,
|
||||
.monaco-editor.hc-black .delete-sign,
|
||||
.monaco-diff-editor.hc-black .delete-sign {
|
||||
background-image: url('deletion-inverse.svg');
|
||||
background-image: url('deletion-dark.svg');
|
||||
}
|
||||
|
||||
.monaco-editor .inline-deleted-margin-view-zone {
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
margin: 2px 0;
|
||||
}
|
||||
.monaco-diff-editor .action-label.icon.close-diff-review {
|
||||
background: url('close.svg') center center no-repeat;
|
||||
background: url('close-light.svg') center center no-repeat;
|
||||
}
|
||||
.monaco-diff-editor.hc-black .action-label.icon.close-diff-review,
|
||||
.monaco-diff-editor.vs-dark .action-label.icon.close-diff-review {
|
||||
background: url('close-inverse.svg') center center no-repeat;
|
||||
background: url('close-dark.svg') center center no-repeat;
|
||||
}
|
||||