mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -345,14 +345,9 @@ export class Configuration extends CommonEditorConfiguration {
|
||||
|
||||
private _getExtraEditorClassName(): string {
|
||||
let extra = '';
|
||||
if (browser.isIE) {
|
||||
extra += 'ie ';
|
||||
} else if (browser.isFirefox) {
|
||||
extra += 'ff ';
|
||||
} else if (browser.isEdge) {
|
||||
extra += 'edge ';
|
||||
} else if (browser.isSafari) {
|
||||
extra += 'safari ';
|
||||
if (!browser.isSafari && !browser.isWebkitWebView) {
|
||||
// Use user-select: none in all browsers except Safari and native macOS WebView
|
||||
extra += 'no-user-select ';
|
||||
}
|
||||
if (platform.isMacintosh) {
|
||||
extra += 'mac ';
|
||||
|
||||
@@ -29,7 +29,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
||||
const CORE_WEIGHT = KeybindingWeight.EditorCore;
|
||||
|
||||
export abstract class CoreEditorCommand extends EditorCommand {
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
|
||||
public runEditorCommand(accessor: ServicesAccessor | null, editor: ICodeEditor, args: any): void {
|
||||
const cursors = editor._getCursors();
|
||||
if (!cursors) {
|
||||
// the editor has no view => has no cursors
|
||||
@@ -1720,8 +1720,10 @@ registerCommand(new EditorOrNativeTextInputCommand({
|
||||
primary: KeyMod.CtrlCmd | KeyCode.KEY_A
|
||||
},
|
||||
menubarOpts: {
|
||||
menuId: MenuId.MenubarSelectionMenu,
|
||||
group: '1_basic',
|
||||
// {{SQL CARBON EDIT}} - Put this in the edit menu since we disabled the selection menu
|
||||
menuId: MenuId.MenubarEditMenu,
|
||||
group: '4_find_global',
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
title: nls.localize({ key: 'miSelectAll', comment: ['&& denotes a mnemonic'] }, "&&Select All"),
|
||||
order: 1
|
||||
}
|
||||
|
||||
@@ -539,8 +539,7 @@ export class MouseTargetFactory {
|
||||
// Check if we've hit a painted cursor
|
||||
const lastViewCursorsRenderData = ctx.lastViewCursorsRenderData;
|
||||
|
||||
for (let i = 0, len = lastViewCursorsRenderData.length; i < len; i++) {
|
||||
const d = lastViewCursorsRenderData[i];
|
||||
for (const d of lastViewCursorsRenderData) {
|
||||
|
||||
if (request.target === d.domNode) {
|
||||
return request.fulfill(MouseTargetType.CONTENT_TEXT, d.position);
|
||||
@@ -558,8 +557,7 @@ export class MouseTargetFactory {
|
||||
const mouseContentHorizontalOffset = request.mouseContentHorizontalOffset;
|
||||
const mouseVerticalOffset = request.mouseVerticalOffset;
|
||||
|
||||
for (let i = 0, len = lastViewCursorsRenderData.length; i < len; i++) {
|
||||
const d = lastViewCursorsRenderData[i];
|
||||
for (const d of lastViewCursorsRenderData) {
|
||||
|
||||
if (mouseContentHorizontalOffset < d.contentLeft) {
|
||||
// mouse position is to the left of the cursor
|
||||
@@ -645,7 +643,7 @@ export class MouseTargetFactory {
|
||||
// This most likely indicates it happened after the last view-line
|
||||
const lineCount = ctx.model.getLineCount();
|
||||
const maxLineColumn = ctx.model.getLineMaxColumn(lineCount);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineCount, maxLineColumn), void 0, EMPTY_CONTENT_AFTER_LINES);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineCount, maxLineColumn), undefined, EMPTY_CONTENT_AFTER_LINES);
|
||||
}
|
||||
|
||||
if (domHitTestExecuted) {
|
||||
@@ -656,7 +654,7 @@ export class MouseTargetFactory {
|
||||
if (ctx.model.getLineLength(lineNumber) === 0) {
|
||||
const lineWidth = ctx.getLineWidth(lineNumber);
|
||||
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, 1), void 0, detail);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, 1), undefined, detail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,10 +729,10 @@ export class MouseTargetFactory {
|
||||
if (browser.isEdge && pos.column === 1) {
|
||||
// See https://github.com/Microsoft/vscode/issues/10875
|
||||
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, ctx.model.getLineMaxColumn(lineNumber)), void 0, detail);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, new Position(lineNumber, ctx.model.getLineMaxColumn(lineNumber)), undefined, detail);
|
||||
}
|
||||
const detail = createEmptyContentDataInLines(request.mouseContentHorizontalOffset - lineWidth);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, pos, void 0, detail);
|
||||
return request.fulfill(MouseTargetType.CONTENT_EMPTY, pos, undefined, detail);
|
||||
}
|
||||
|
||||
const visibleRange = ctx.visibleRangeForPosition2(lineNumber, column);
|
||||
|
||||
@@ -682,7 +682,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
getTelemetryData(): { [key: string]: any; } | null;
|
||||
getTelemetryData(): { [key: string]: any } | undefined;
|
||||
|
||||
/**
|
||||
* Returns the editor's dom node
|
||||
@@ -732,7 +732,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
|
||||
/**
|
||||
* Force an editor render now.
|
||||
*/
|
||||
render(): void;
|
||||
render(forceRedraw?: boolean): void;
|
||||
|
||||
/**
|
||||
* Get the hit test target at coordinates `clientX` and `clientY`.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IPosition } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { always } from 'vs/base/common/async';
|
||||
import { illegalArgument } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
@@ -108,7 +107,7 @@ export abstract class Command {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract runCommand(accessor: ServicesAccessor, args: any): void | Thenable<void>;
|
||||
public abstract runCommand(accessor: ServicesAccessor, args: any): void | Promise<void>;
|
||||
}
|
||||
|
||||
//#endregion Command
|
||||
@@ -116,7 +115,7 @@ export abstract class Command {
|
||||
//#region EditorCommand
|
||||
|
||||
export interface IContributionCommandOptions<T> extends ICommandOptions {
|
||||
handler: (controller: T) => void;
|
||||
handler: (controller: T, args: any) => void;
|
||||
}
|
||||
export interface EditorControllerCommand<T extends IEditorContribution> {
|
||||
new(opts: IContributionCommandOptions<T>): EditorCommand;
|
||||
@@ -128,7 +127,7 @@ export abstract class EditorCommand extends Command {
|
||||
*/
|
||||
public static bindToContribution<T extends IEditorContribution>(controllerGetter: (editor: ICodeEditor) => T): EditorControllerCommand<T> {
|
||||
return class EditorControllerCommandImpl extends EditorCommand {
|
||||
private _callback: (controller: T) => void;
|
||||
private _callback: (controller: T, args: any) => void;
|
||||
|
||||
constructor(opts: IContributionCommandOptions<T>) {
|
||||
super(opts);
|
||||
@@ -139,13 +138,13 @@ export abstract class EditorCommand extends Command {
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void {
|
||||
let controller = controllerGetter(editor);
|
||||
if (controller) {
|
||||
this._callback(controllerGetter(editor));
|
||||
this._callback(controllerGetter(editor), args);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public runCommand(accessor: ServicesAccessor, args: any): void | Thenable<void> {
|
||||
public runCommand(accessor: ServicesAccessor, args: any): void | Promise<void> {
|
||||
const codeEditorService = accessor.get(ICodeEditorService);
|
||||
|
||||
// Find the editor with text focus or active
|
||||
@@ -166,7 +165,7 @@ export abstract class EditorCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
public abstract runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Thenable<void>;
|
||||
public abstract runEditorCommand(accessor: ServicesAccessor | null, editor: ICodeEditor, args: any): void | Promise<void>;
|
||||
}
|
||||
|
||||
//#endregion EditorCommand
|
||||
@@ -213,7 +212,7 @@ export abstract class EditorAction extends EditorCommand {
|
||||
super.register();
|
||||
}
|
||||
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Thenable<void> {
|
||||
public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise<void> {
|
||||
this.reportTelemetry(accessor, editor);
|
||||
return this.run(accessor, editor, args || {});
|
||||
}
|
||||
@@ -231,7 +230,7 @@ export abstract class EditorAction extends EditorCommand {
|
||||
accessor.get(ITelemetryService).publicLog('editorActionInvoked', { name: this.label, id: this.id, ...editor.getTelemetryData() });
|
||||
}
|
||||
|
||||
public abstract run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Thenable<void>;
|
||||
public abstract run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | Promise<void>;
|
||||
}
|
||||
|
||||
//#endregion EditorAction
|
||||
@@ -266,14 +265,14 @@ export function registerDefaultLanguageCommand(id: string, handler: (model: ITex
|
||||
}
|
||||
|
||||
return accessor.get(ITextModelService).createModelReference(resource).then(reference => {
|
||||
return always(new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
let result = handler(reference.object.textEditorModel, Position.lift(position), args);
|
||||
resolve(result);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
}), () => {
|
||||
}).finally(() => {
|
||||
reference.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -74,8 +74,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
||||
let editorWithWidgetFocus: ICodeEditor | null = null;
|
||||
|
||||
let editors = this.listCodeEditors();
|
||||
for (let i = 0; i < editors.length; i++) {
|
||||
let editor = editors[i];
|
||||
for (const editor of editors) {
|
||||
|
||||
if (editor.hasTextFocus()) {
|
||||
// bingo!
|
||||
@@ -126,7 +125,7 @@ export abstract class AbstractCodeEditorService extends Disposable implements IC
|
||||
}
|
||||
|
||||
abstract getActiveCodeEditor(): ICodeEditor | null;
|
||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Thenable<ICodeEditor | null>;
|
||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
||||
}
|
||||
|
||||
export class ModelTransientSettingWatcher {
|
||||
|
||||
@@ -45,5 +45,5 @@ export interface ICodeEditorService {
|
||||
getTransientModelProperty(model: ITextModel, key: string): any;
|
||||
|
||||
getActiveCodeEditor(): ICodeEditor | null;
|
||||
openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Thenable<ICodeEditor | null>;
|
||||
openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export abstract class CodeEditorServiceImpl extends AbstractCodeEditorService {
|
||||
}
|
||||
|
||||
abstract getActiveCodeEditor(): ICodeEditor | null;
|
||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Thenable<ICodeEditor | null>;
|
||||
abstract openCodeEditor(input: IResourceInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null>;
|
||||
}
|
||||
|
||||
interface IModelDecorationOptionsProvider extends IDisposable {
|
||||
@@ -147,7 +147,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
||||
if (rules.hasContent) {
|
||||
return rules.className;
|
||||
}
|
||||
return void 0;
|
||||
return undefined;
|
||||
};
|
||||
const createInlineCSSRules = (type: ModelDecorationCSSRuleType) => {
|
||||
const rules = new DecorationCSSRules(type, providerArgs, themeService);
|
||||
@@ -210,7 +210,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
||||
|
||||
const _CSS_MAP: { [prop: string]: string; } = {
|
||||
color: 'color:{0} !important;',
|
||||
opacity: 'opacity:{0}; will-change: opacity;', // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196
|
||||
opacity: 'opacity:{0};',
|
||||
backgroundColor: 'background-color:{0};',
|
||||
|
||||
outline: 'outline:{0};',
|
||||
|
||||
@@ -10,10 +10,7 @@ import * as resources from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
||||
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
|
||||
export class OpenerService implements IOpenerService {
|
||||
|
||||
@@ -22,29 +19,28 @@ export class OpenerService implements IOpenerService {
|
||||
constructor(
|
||||
@ICodeEditorService private readonly _editorService: ICodeEditorService,
|
||||
@ICommandService private readonly _commandService: ICommandService,
|
||||
@optional(ITelemetryService) private _telemetryService: ITelemetryService | null = NullTelemetryService
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
open(resource: URI, options?: { openToSide?: boolean }): Promise<any> {
|
||||
|
||||
if (this._telemetryService) {
|
||||
/* __GDPR__
|
||||
"openerService" : {
|
||||
"scheme" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog('openerService', { scheme: resource.scheme });
|
||||
}
|
||||
open(resource: URI, options?: { openToSide?: boolean }): Promise<boolean> {
|
||||
|
||||
const { scheme, path, query, fragment } = resource;
|
||||
let promise: Thenable<any> | undefined = undefined;
|
||||
|
||||
if (scheme === Schemas.http || scheme === Schemas.https || scheme === Schemas.mailto) {
|
||||
if (!scheme) {
|
||||
// no scheme ?!?
|
||||
return Promise.resolve(false);
|
||||
|
||||
} else if (scheme === Schemas.http || scheme === Schemas.https || scheme === Schemas.mailto) {
|
||||
// open http or default mail application
|
||||
dom.windowOpenNoOpener(resource.toString(true));
|
||||
} else if (scheme === 'command' && CommandsRegistry.getCommand(path)) {
|
||||
return Promise.resolve(true);
|
||||
|
||||
} else if (scheme === Schemas.command) {
|
||||
// run command or bail out if command isn't known
|
||||
if (!CommandsRegistry.getCommand(path)) {
|
||||
return Promise.reject(`command '${path}' NOT known`);
|
||||
}
|
||||
// execute as command
|
||||
let args: any = [];
|
||||
try {
|
||||
@@ -55,13 +51,10 @@ export class OpenerService implements IOpenerService {
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
promise = this._commandService.executeCommand(path, ...args);
|
||||
return this._commandService.executeCommand(path, ...args).then(() => true);
|
||||
|
||||
} else {
|
||||
let selection: {
|
||||
startLineNumber: number;
|
||||
startColumn: number;
|
||||
} | undefined = undefined;
|
||||
let selection: { startLineNumber: number; startColumn: number; } | undefined = undefined;
|
||||
const match = /^L?(\d+)(?:,(\d+))?/.exec(fragment);
|
||||
if (match) {
|
||||
// support file:///some/file.js#73,84
|
||||
@@ -74,16 +67,15 @@ export class OpenerService implements IOpenerService {
|
||||
resource = resource.with({ fragment: '' });
|
||||
}
|
||||
|
||||
if (!resource.scheme) {
|
||||
// we cannot handle those
|
||||
return Promise.resolve(undefined);
|
||||
|
||||
} else if (resource.scheme === Schemas.file) {
|
||||
if (resource.scheme === Schemas.file) {
|
||||
resource = resources.normalizePath(resource); // workaround for non-normalized paths (https://github.com/Microsoft/vscode/issues/12954)
|
||||
}
|
||||
promise = this._editorService.openCodeEditor({ resource, options: { selection, } }, this._editorService.getFocusedCodeEditor(), options && options.openToSide);
|
||||
}
|
||||
|
||||
return Promise.resolve(promise);
|
||||
return this._editorService.openCodeEditor(
|
||||
{ resource, options: { selection, } },
|
||||
this._editorService.getFocusedCodeEditor(),
|
||||
options && options.openToSide
|
||||
).then(() => true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,6 +445,7 @@ export class View extends ViewEventHandler {
|
||||
|
||||
public restoreState(scrollPosition: { scrollLeft: number; scrollTop: number; }): void {
|
||||
this._context.viewLayout.setScrollPositionNow({ scrollTop: scrollPosition.scrollTop });
|
||||
this._context.model.tokenizeViewport();
|
||||
this._renderNow();
|
||||
this.viewLines.updateLineWidths();
|
||||
this._context.viewLayout.setScrollPositionNow({ scrollLeft: scrollPosition.scrollLeft });
|
||||
|
||||
@@ -47,13 +47,13 @@ export class ViewOutgoingEvents extends Disposable {
|
||||
|
||||
public emitViewFocusGained(): void {
|
||||
if (this.onDidGainFocus) {
|
||||
this.onDidGainFocus(void 0);
|
||||
this.onDidGainFocus(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public emitViewFocusLost(): void {
|
||||
if (this.onDidLoseFocus) {
|
||||
this.onDidLoseFocus(void 0);
|
||||
this.onDidLoseFocus(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,7 @@ export class ViewContentWidgets extends ViewPart {
|
||||
|
||||
public onConfigurationChanged(e: viewEvents.ViewConfigurationChangedEvent): boolean {
|
||||
let keys = Object.keys(this._widgets);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const widgetId = keys[i];
|
||||
for (const widgetId of keys) {
|
||||
this._widgets[widgetId].onConfigurationChanged(e);
|
||||
}
|
||||
return true;
|
||||
@@ -75,8 +74,7 @@ export class ViewContentWidgets extends ViewPart {
|
||||
}
|
||||
public onLineMappingChanged(e: viewEvents.ViewLineMappingChangedEvent): boolean {
|
||||
let keys = Object.keys(this._widgets);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const widgetId = keys[i];
|
||||
for (const widgetId of keys) {
|
||||
this._widgets[widgetId].onLineMappingChanged(e);
|
||||
}
|
||||
return true;
|
||||
@@ -142,24 +140,21 @@ export class ViewContentWidgets extends ViewPart {
|
||||
|
||||
public onBeforeRender(viewportData: ViewportData): void {
|
||||
let keys = Object.keys(this._widgets);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const widgetId = keys[i];
|
||||
for (const widgetId of keys) {
|
||||
this._widgets[widgetId].onBeforeRender(viewportData);
|
||||
}
|
||||
}
|
||||
|
||||
public prepareRender(ctx: RenderingContext): void {
|
||||
let keys = Object.keys(this._widgets);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const widgetId = keys[i];
|
||||
for (const widgetId of keys) {
|
||||
this._widgets[widgetId].prepareRender(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
public render(ctx: RestrictedRenderingContext): void {
|
||||
let keys = Object.keys(this._widgets);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const widgetId = keys[i];
|
||||
for (const widgetId of keys) {
|
||||
this._widgets[widgetId].render(ctx);
|
||||
}
|
||||
}
|
||||
@@ -458,9 +453,8 @@ class Widget {
|
||||
// Do two passes, first for perfect fit, second picks first option
|
||||
if (this._preference) {
|
||||
for (let pass = 1; pass <= 2; pass++) {
|
||||
for (let i = 0; i < this._preference.length; i++) {
|
||||
for (const pref of this._preference) {
|
||||
// placement
|
||||
let pref = this._preference[i];
|
||||
if (pref === ContentWidgetPositionPreference.ABOVE) {
|
||||
if (!placement) {
|
||||
// Widget outside of viewport
|
||||
|
||||
@@ -65,7 +65,6 @@ export class CurrentLineHighlightOverlay extends DynamicViewOverlay {
|
||||
const selectionIsEmpty = e.selections[0].isEmpty();
|
||||
if (this._selectionIsEmpty !== selectionIsEmpty) {
|
||||
this._selectionIsEmpty = selectionIsEmpty;
|
||||
hasChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ export class CurrentLineMarginHighlightOverlay extends DynamicViewOverlay {
|
||||
const selectionIsEmpty = e.selections[0].isEmpty();
|
||||
if (this._selectionIsEmpty !== selectionIsEmpty) {
|
||||
this._selectionIsEmpty = selectionIsEmpty;
|
||||
hasChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ export class EditorScrollbar extends ViewPart {
|
||||
handleMouseWheel: configScrollbarOpts.handleMouseWheel,
|
||||
arrowSize: configScrollbarOpts.arrowSize,
|
||||
mouseWheelScrollSensitivity: configScrollbarOpts.mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: configScrollbarOpts.fastScrollSensitivity,
|
||||
};
|
||||
|
||||
this.scrollbar = this._register(new SmoothScrollableElement(linesContent.domNode, scrollbarOptions, this._context.viewLayout.scrollable));
|
||||
@@ -127,7 +128,8 @@ export class EditorScrollbar extends ViewPart {
|
||||
const editor = this._context.configuration.editor;
|
||||
let newOpts: ScrollableElementChangeOptions = {
|
||||
handleMouseWheel: editor.viewInfo.scrollbar.handleMouseWheel,
|
||||
mouseWheelScrollSensitivity: editor.viewInfo.scrollbar.mouseWheelScrollSensitivity
|
||||
mouseWheelScrollSensitivity: editor.viewInfo.scrollbar.mouseWheelScrollSensitivity,
|
||||
fastScrollSensitivity: editor.viewInfo.scrollbar.fastScrollSensitivity
|
||||
};
|
||||
this.scrollbar.updateOptions(newOpts);
|
||||
}
|
||||
|
||||
@@ -173,8 +173,7 @@ export class ViewLine implements IVisibleLine {
|
||||
|
||||
if (alwaysRenderInlineSelection || options.themeType === HIGH_CONTRAST) {
|
||||
const selections = viewportData.selections;
|
||||
for (let i = 0, len = selections.length; i < len; i++) {
|
||||
const selection = selections[i];
|
||||
for (const selection of selections) {
|
||||
|
||||
if (selection.endLineNumber < lineNumber || selection.startLineNumber > lineNumber) {
|
||||
// Selection does not intersect line
|
||||
|
||||
@@ -14,16 +14,9 @@
|
||||
100% { background-color: none }
|
||||
}*/
|
||||
|
||||
.monaco-editor.safari .lines-content,
|
||||
.monaco-editor.safari .view-line,
|
||||
.monaco-editor.safari .view-lines {
|
||||
-webkit-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.monaco-editor .lines-content,
|
||||
.monaco-editor .view-line,
|
||||
.monaco-editor .view-lines {
|
||||
.monaco-editor.no-user-select .lines-content,
|
||||
.monaco-editor.no-user-select .view-line,
|
||||
.monaco-editor.no-user-select .view-lines {
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
|
||||
@@ -639,8 +639,7 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
|
||||
};
|
||||
}
|
||||
|
||||
for (let i = 0; i < visibleRanges.length; i++) {
|
||||
let visibleRange = visibleRanges[i];
|
||||
for (const visibleRange of visibleRanges) {
|
||||
if (visibleRange.left < boxStartX) {
|
||||
boxStartX = visibleRange.left;
|
||||
}
|
||||
|
||||
@@ -132,8 +132,7 @@ export class OverviewRuler extends ViewEventHandler implements IOverviewRuler {
|
||||
let currentFrom = 0;
|
||||
let currentTo = 0;
|
||||
|
||||
for (let i = 0, len = colorZones.length; i < len; i++) {
|
||||
const zone = colorZones[i];
|
||||
for (const zone of colorZones) {
|
||||
|
||||
const zoneColorId = zone.colorId;
|
||||
const zoneFrom = zone.from;
|
||||
|
||||
@@ -180,8 +180,8 @@ export class ViewCursors extends ViewPart {
|
||||
if (shouldRender(this._primaryCursor.getPosition())) {
|
||||
return true;
|
||||
}
|
||||
for (let i = 0; i < this._secondaryCursors.length; i++) {
|
||||
if (shouldRender(this._secondaryCursors[i].getPosition())) {
|
||||
for (const secondaryCursor of this._secondaryCursors) {
|
||||
if (shouldRender(secondaryCursor.getPosition())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
//#endregion
|
||||
|
||||
public readonly isSimpleWidget: boolean;
|
||||
private readonly _telemetryData: object | null;
|
||||
private readonly _telemetryData?: object;
|
||||
|
||||
private readonly _domElement: HTMLElement;
|
||||
private readonly _id: number;
|
||||
@@ -245,7 +245,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._decorationTypeKeysToIds = {};
|
||||
this._decorationTypeSubtypes = {};
|
||||
this.isSimpleWidget = codeEditorWidgetOptions.isSimpleWidget || false;
|
||||
this._telemetryData = codeEditorWidgetOptions.telemetryData || null;
|
||||
this._telemetryData = codeEditorWidgetOptions.telemetryData;
|
||||
|
||||
options = options || {};
|
||||
this._configuration = this._register(this._createConfiguration(options));
|
||||
@@ -396,7 +396,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return this._modelData.model;
|
||||
}
|
||||
|
||||
public setModel(model: ITextModel | null = null): void {
|
||||
public setModel(_model: ITextModel | editorCommon.IDiffEditorModel | null = null): void {
|
||||
const model = <ITextModel | null>_model;
|
||||
if (this._modelData === null && model === null) {
|
||||
// Current model is the new model
|
||||
return;
|
||||
@@ -800,8 +801,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
const contributionsState: { [key: string]: any } = {};
|
||||
|
||||
const keys = Object.keys(this._contributions);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const id = keys[i];
|
||||
for (const id of keys) {
|
||||
const contribution = this._contributions[id];
|
||||
if (typeof contribution.saveViewState === 'function') {
|
||||
contributionsState[id] = contribution.saveViewState();
|
||||
@@ -817,12 +817,12 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
};
|
||||
}
|
||||
|
||||
public restoreViewState(s: editorCommon.ICodeEditorViewState): void {
|
||||
public restoreViewState(s: editorCommon.IEditorViewState | null): void {
|
||||
if (!this._modelData || !this._modelData.hasRealView) {
|
||||
return;
|
||||
}
|
||||
if (s && s.cursorState && s.viewState) {
|
||||
let codeEditorState = <editorCommon.ICodeEditorViewState>s;
|
||||
const codeEditorState = s as editorCommon.ICodeEditorViewState | null;
|
||||
if (codeEditorState && codeEditorState.cursorState && codeEditorState.viewState) {
|
||||
let cursorState = <any>codeEditorState.cursorState;
|
||||
if (Array.isArray(cursorState)) {
|
||||
this._modelData.cursor.restoreState(<editorCommon.ICursorState[]>cursorState);
|
||||
@@ -831,7 +831,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
this._modelData.cursor.restoreState([<editorCommon.ICursorState>cursorState]);
|
||||
}
|
||||
|
||||
let contributionsState = s.contributionsState || {};
|
||||
let contributionsState = codeEditorState.contributionsState || {};
|
||||
let keys = Object.keys(this._contributions);
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
let id = keys[i];
|
||||
@@ -841,11 +841,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}
|
||||
}
|
||||
|
||||
const reducedState = this._modelData.viewModel.reduceRestoreState(s.viewState);
|
||||
const linesViewportData = this._modelData.viewModel.viewLayout.getLinesViewportDataAtScrollTop(reducedState.scrollTop);
|
||||
const startPosition = this._modelData.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(linesViewportData.startLineNumber, 1));
|
||||
const endPosition = this._modelData.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new Position(linesViewportData.endLineNumber, 1));
|
||||
this._modelData.model.tokenizeViewport(startPosition.lineNumber, endPosition.lineNumber);
|
||||
const reducedState = this._modelData.viewModel.reduceRestoreState(codeEditorState.viewState);
|
||||
this._modelData.view.restoreState(reducedState);
|
||||
}
|
||||
}
|
||||
@@ -929,7 +925,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
|
||||
const action = this.getAction(handlerId);
|
||||
if (action) {
|
||||
Promise.resolve(action.run()).then(null, onUnexpectedError);
|
||||
Promise.resolve(action.run()).then(undefined, onUnexpectedError);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -950,7 +946,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
payload = payload || {};
|
||||
payload.source = source;
|
||||
this._instantiationService.invokeFunction((accessor) => {
|
||||
Promise.resolve(command.runEditorCommand(accessor, this, payload)).then(null, onUnexpectedError);
|
||||
Promise.resolve(command.runEditorCommand(accessor, this, payload)).then(undefined, onUnexpectedError);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -1282,11 +1278,11 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
return this._modelData.view.getOffsetForColumn(lineNumber, column);
|
||||
}
|
||||
|
||||
public render(): void {
|
||||
public render(forceRedraw: boolean = false): void {
|
||||
if (!this._modelData || !this._modelData.hasRealView) {
|
||||
return;
|
||||
}
|
||||
this._modelData.view.render(true, false);
|
||||
this._modelData.view.render(true, forceRedraw);
|
||||
}
|
||||
|
||||
public applyFontInfo(target: HTMLElement): void {
|
||||
@@ -1327,7 +1323,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
}));
|
||||
|
||||
listenersToRemove.push(cursor.onDidAttemptReadOnlyEdit(() => {
|
||||
this._onDidAttemptReadOnlyEdit.fire(void 0);
|
||||
this._onDidAttemptReadOnlyEdit.fire(undefined);
|
||||
}));
|
||||
|
||||
listenersToRemove.push(cursor.onDidChange((e: CursorStateChangedEvent) => {
|
||||
@@ -1506,7 +1502,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
||||
/* __GDPR__FRAGMENT__
|
||||
"EditorTelemetryData" : {}
|
||||
*/
|
||||
public getTelemetryData(): { [key: string]: any; } | null {
|
||||
public getTelemetryData(): { [key: string]: any; } | undefined {
|
||||
return this._telemetryData;
|
||||
}
|
||||
|
||||
@@ -1766,11 +1762,11 @@ class CodeEditorWidgetFocusTracker extends Disposable {
|
||||
|
||||
this._register(this._domFocusTracker.onDidFocus(() => {
|
||||
this._hasFocus = true;
|
||||
this._onChange.fire(void 0);
|
||||
this._onChange.fire(undefined);
|
||||
}));
|
||||
this._register(this._domFocusTracker.onDidBlur(() => {
|
||||
this._hasFocus = false;
|
||||
this._onChange.fire(void 0);
|
||||
this._onChange.fire(undefined);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -1832,7 +1828,7 @@ registerThemingParticipant((theme, collector) => {
|
||||
|
||||
const unnecessaryForeground = theme.getColor(editorUnnecessaryCodeOpacity);
|
||||
if (unnecessaryForeground) {
|
||||
collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; will-change: opacity; }`); // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196
|
||||
collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; }`);
|
||||
}
|
||||
|
||||
const unnecessaryBorder = theme.getColor(editorUnnecessaryCodeBorder);
|
||||
|
||||
@@ -369,15 +369,19 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode());
|
||||
this._originalOverviewRuler.dispose();
|
||||
}
|
||||
this._originalOverviewRuler = this.originalEditor.createOverviewRuler('original diffOverviewRuler');
|
||||
this._overviewDomElement.appendChild(this._originalOverviewRuler.getDomNode());
|
||||
if (this.originalEditor.hasModel()) {
|
||||
this._originalOverviewRuler = this.originalEditor.createOverviewRuler('original diffOverviewRuler')!;
|
||||
this._overviewDomElement.appendChild(this._originalOverviewRuler.getDomNode());
|
||||
}
|
||||
|
||||
if (this._modifiedOverviewRuler) {
|
||||
this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode());
|
||||
this._modifiedOverviewRuler.dispose();
|
||||
}
|
||||
this._modifiedOverviewRuler = this.modifiedEditor.createOverviewRuler('modified diffOverviewRuler');
|
||||
this._overviewDomElement.appendChild(this._modifiedOverviewRuler.getDomNode());
|
||||
if (this.modifiedEditor.hasModel()) {
|
||||
this._modifiedOverviewRuler = this.modifiedEditor.createOverviewRuler('modified diffOverviewRuler')!;
|
||||
this._overviewDomElement.appendChild(this._modifiedOverviewRuler.getDomNode());
|
||||
}
|
||||
|
||||
this._layoutOverviewRulers();
|
||||
}
|
||||
@@ -597,8 +601,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
|
||||
public getModel(): editorCommon.IDiffEditorModel {
|
||||
return {
|
||||
original: this.originalEditor.getModel(),
|
||||
modified: this.modifiedEditor.getModel()
|
||||
original: this.originalEditor.getModel()!,
|
||||
modified: this.modifiedEditor.getModel()!
|
||||
};
|
||||
}
|
||||
|
||||
@@ -739,7 +743,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
}
|
||||
|
||||
public restoreViewState(s: editorCommon.IDiffEditorViewState): void {
|
||||
if (s.original && s.original) {
|
||||
if (s.original && s.modified) {
|
||||
let diffEditorState = <editorCommon.IDiffEditorViewState>s;
|
||||
this.originalEditor.restoreViewState(diffEditorState.original);
|
||||
this.modifiedEditor.restoreViewState(diffEditorState.modified);
|
||||
@@ -964,7 +968,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
private _adjustOptionsForRightHandSide(options: editorOptions.IDiffEditorOptions): editorOptions.IEditorOptions {
|
||||
let result = this._adjustOptionsForSubEditor(options);
|
||||
result.revealHorizontalRightPadding = editorOptions.EDITOR_DEFAULTS.viewInfo.revealHorizontalRightPadding + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
result.scrollbar.verticalHasArrows = false;
|
||||
result.scrollbar!.verticalHasArrows = false;
|
||||
result.extraEditorClassName = 'modified-in-monaco-diff-editor';
|
||||
return result;
|
||||
}
|
||||
@@ -1446,16 +1450,19 @@ abstract class ViewZonesComputer {
|
||||
// ---------------------------- END EMIT MINIMAL VIEW ZONES
|
||||
}
|
||||
|
||||
let ensureDomNode = (z: IMyViewZone) => {
|
||||
return {
|
||||
original: ViewZonesComputer._ensureDomNodes(result.original),
|
||||
modified: ViewZonesComputer._ensureDomNodes(result.modified),
|
||||
};
|
||||
}
|
||||
|
||||
private static _ensureDomNodes(zones: IMyViewZone[]): editorBrowser.IViewZone[] {
|
||||
return zones.map((z) => {
|
||||
if (!z.domNode) {
|
||||
z.domNode = createFakeLinesDiv();
|
||||
}
|
||||
};
|
||||
|
||||
result.original.forEach(ensureDomNode);
|
||||
result.modified.forEach(ensureDomNode);
|
||||
|
||||
return result;
|
||||
return <editorBrowser.IViewZone>z;
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract _createOriginalMarginDomNodeForModifiedForeignViewZoneInAddedRegion(): HTMLDivElement | null;
|
||||
@@ -1526,8 +1533,8 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
|
||||
private _disableSash: boolean;
|
||||
private _sash: Sash;
|
||||
private _sashRatio: number;
|
||||
private _sashPosition: number;
|
||||
private _sashRatio: number | null;
|
||||
private _sashPosition: number | null;
|
||||
private _startSashPosition: number;
|
||||
|
||||
constructor(dataSource: IDataSource, enableSplitViewResizing: boolean) {
|
||||
@@ -1556,7 +1563,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
}
|
||||
}
|
||||
|
||||
public layout(sashRatio: number = this._sashRatio): number {
|
||||
public layout(sashRatio: number | null = this._sashRatio): number {
|
||||
let w = this._dataSource.getWidth();
|
||||
let contentWidth = w - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
|
||||
|
||||
@@ -1586,7 +1593,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
}
|
||||
|
||||
private onSashDragStart(): void {
|
||||
this._startSashPosition = this._sashPosition;
|
||||
this._startSashPosition = this._sashPosition!;
|
||||
}
|
||||
|
||||
private onSashDrag(e: ISashEvent): void {
|
||||
@@ -1614,7 +1621,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
}
|
||||
|
||||
public getVerticalSashLeft(sash: Sash): number {
|
||||
return this._sashPosition;
|
||||
return this._sashPosition!;
|
||||
}
|
||||
|
||||
public getVerticalSashHeight(sash: Sash): number {
|
||||
@@ -1634,7 +1641,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
overviewZones: []
|
||||
};
|
||||
|
||||
let originalModel = originalEditor.getModel();
|
||||
let originalModel = originalEditor.getModel()!;
|
||||
|
||||
for (let i = 0, length = lineChanges.length; i < length; i++) {
|
||||
let lineChange = lineChanges[i];
|
||||
@@ -1694,7 +1701,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
overviewZones: []
|
||||
};
|
||||
|
||||
let modifiedModel = modifiedEditor.getModel();
|
||||
let modifiedModel = modifiedEditor.getModel()!;
|
||||
|
||||
for (let i = 0, length = lineChanges.length; i < length; i++) {
|
||||
let lineChange = lineChanges[i];
|
||||
@@ -1843,7 +1850,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
overviewZones: []
|
||||
};
|
||||
|
||||
let modifiedModel = modifiedEditor.getModel();
|
||||
let modifiedModel = modifiedEditor.getModel()!;
|
||||
|
||||
for (let i = 0, length = lineChanges.length; i < length; i++) {
|
||||
let lineChange = lineChanges[i];
|
||||
@@ -1911,9 +1918,9 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
|
||||
constructor(lineChanges: editorCommon.ILineChange[], originalForeignVZ: IEditorWhitespace[], modifiedForeignVZ: IEditorWhitespace[], originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor, renderIndicators: boolean) {
|
||||
super(lineChanges, originalForeignVZ, modifiedForeignVZ);
|
||||
this.originalModel = originalEditor.getModel();
|
||||
this.originalModel = originalEditor.getModel()!;
|
||||
this.modifiedEditorConfiguration = modifiedEditor.getConfiguration();
|
||||
this.modifiedEditorTabSize = modifiedEditor.getModel().getOptions().tabSize;
|
||||
this.modifiedEditorTabSize = modifiedEditor.getModel()!.getOptions().tabSize;
|
||||
this.renderIndicators = renderIndicators;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ export class DiffReview extends Disposable {
|
||||
private readonly _content: FastDomNode<HTMLElement>;
|
||||
private readonly scrollbar: DomScrollableElement;
|
||||
private _diffs: Diff[];
|
||||
private _currentDiff: Diff;
|
||||
private _currentDiff: Diff | null;
|
||||
|
||||
constructor(diffEditor: DiffEditorWidget) {
|
||||
super();
|
||||
@@ -100,7 +100,7 @@ export class DiffReview extends Disposable {
|
||||
|
||||
this._actionBar.push(new Action('diffreview.close', nls.localize('label.close', "Close"), 'close-diff-review', true, () => {
|
||||
this.hide();
|
||||
return null;
|
||||
return Promise.resolve(null);
|
||||
}), { label: false, icon: true });
|
||||
|
||||
this.domNode = createFastDomNode(document.createElement('div'));
|
||||
@@ -200,7 +200,7 @@ export class DiffReview extends Disposable {
|
||||
}
|
||||
index = (this._diffs.length + currentIndex - 1);
|
||||
} else {
|
||||
index = this._findDiffIndex(this._diffEditor.getPosition());
|
||||
index = this._findDiffIndex(this._diffEditor.getPosition()!);
|
||||
}
|
||||
|
||||
if (this._diffs.length === 0) {
|
||||
@@ -233,7 +233,7 @@ export class DiffReview extends Disposable {
|
||||
}
|
||||
index = (currentIndex + 1);
|
||||
} else {
|
||||
index = this._findDiffIndex(this._diffEditor.getPosition());
|
||||
index = this._findDiffIndex(this._diffEditor.getPosition()!);
|
||||
}
|
||||
|
||||
if (this._diffs.length === 0) {
|
||||
@@ -253,7 +253,7 @@ export class DiffReview extends Disposable {
|
||||
let jumpToLineNumber = -1;
|
||||
let current = this._getCurrentFocusedRow();
|
||||
if (current) {
|
||||
let lineNumber = parseInt(current.getAttribute('data-line'), 10);
|
||||
let lineNumber = parseInt(current.getAttribute('data-line')!, 10);
|
||||
if (!isNaN(lineNumber)) {
|
||||
jumpToLineNumber = lineNumber;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ export class DiffReview extends Disposable {
|
||||
return <HTMLElement>this.domNode.domNode.querySelector('.diff-review-row');
|
||||
}
|
||||
|
||||
private _getCurrentFocusedRow(): HTMLElement {
|
||||
private _getCurrentFocusedRow(): HTMLElement | null {
|
||||
let result = <HTMLElement>document.activeElement;
|
||||
if (result && /diff-review-row/.test(result.className)) {
|
||||
return result;
|
||||
@@ -530,8 +530,8 @@ export class DiffReview extends Disposable {
|
||||
const originalModel = this._diffEditor.getOriginalEditor().getModel();
|
||||
const modifiedModel = this._diffEditor.getModifiedEditor().getModel();
|
||||
|
||||
const originalModelOpts = originalModel.getOptions();
|
||||
const modifiedModelOpts = modifiedModel.getOptions();
|
||||
const originalModelOpts = originalModel!.getOptions();
|
||||
const modifiedModelOpts = modifiedModel!.getOptions();
|
||||
|
||||
if (!this._isVisible || !originalModel || !modifiedModel) {
|
||||
dom.clearNode(this._content.domNode);
|
||||
@@ -540,8 +540,7 @@ export class DiffReview extends Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
const pos = this._diffEditor.getPosition();
|
||||
const diffIndex = this._findDiffIndex(pos);
|
||||
const diffIndex = this._findDiffIndex(this._diffEditor.getPosition()!);
|
||||
|
||||
if (this._diffs[diffIndex] === this._currentDiff) {
|
||||
return;
|
||||
@@ -731,7 +730,7 @@ export class DiffReview extends Disposable {
|
||||
lineContent = nls.localize('blankLine', "blank");
|
||||
}
|
||||
|
||||
let ariaLabel: string;
|
||||
let ariaLabel: string = '';
|
||||
switch (type) {
|
||||
case DiffEntryType.Equal:
|
||||
ariaLabel = nls.localize('equalLine', "original {0}, modified {1}: {2}", originalLine, modifiedLine, lineContent);
|
||||
@@ -848,7 +847,7 @@ class DiffReviewPrev extends EditorAction {
|
||||
}
|
||||
}
|
||||
|
||||
function findFocusedDiffEditor(accessor: ServicesAccessor): DiffEditorWidget {
|
||||
function findFocusedDiffEditor(accessor: ServicesAccessor): DiffEditorWidget | null {
|
||||
const codeEditorService = accessor.get(ICodeEditorService);
|
||||
const diffEditors = codeEditorService.listDiffEditors();
|
||||
for (let i = 0, len = diffEditors.length; i < len; i++) {
|
||||
|
||||
Reference in New Issue
Block a user