Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -125,6 +125,7 @@ export class Colorizer {
[],
tabSize,
0,
0,
-1,
'none',
false,
@@ -193,6 +194,7 @@ function _fakeColorize(lines: string[], tabSize: number): string {
[],
tabSize,
0,
0,
-1,
'none',
false,
@@ -230,6 +232,7 @@ function _actualColorize(lines: string[], tabSize: number, tokenizationSupport:
[],
tabSize,
0,
0,
-1,
'none',
false,

View File

@@ -10,7 +10,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorAction, IActionOptions, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { Range } from 'vs/editor/common/core/range';
import { Selection } from 'vs/editor/common/core/selection';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IEditorContribution, ScrollType, IEditor } from 'vs/editor/common/editorCommon';
import { IModelDeltaDecoration } from 'vs/editor/common/model';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { QuickOpenEditorWidget } from 'vs/editor/standalone/browser/quickOpen/quickOpenEditorWidget';
@@ -22,7 +22,7 @@ export interface IQuickOpenControllerOpts {
getAutoFocus(searchValue: string): IAutoFocus;
}
export class QuickOpenController implements editorCommon.IEditorContribution, IDecorator {
export class QuickOpenController implements IEditorContribution, IDecorator {
public static readonly ID = 'editor.controller.quickOpenController';
@@ -61,7 +61,7 @@ export class QuickOpenController implements editorCommon.IEditorContribution, ID
// Restore selection if canceled
if (canceled && this.lastKnownEditorSelection) {
this.editor.setSelection(this.lastKnownEditorSelection);
this.editor.revealRangeInCenterIfOutsideViewport(this.lastKnownEditorSelection, editorCommon.ScrollType.Smooth);
this.editor.revealRangeInCenterIfOutsideViewport(this.lastKnownEditorSelection, ScrollType.Smooth);
}
this.lastKnownEditorSelection = null;
@@ -165,7 +165,7 @@ export abstract class BaseEditorQuickOpenAction extends EditorAction {
}
export interface IDecorator {
decorateLine(range: Range, editor: editorCommon.IEditor): void;
decorateLine(range: Range, editor: IEditor): void;
clearDecorations(): void;
}

View File

@@ -12,7 +12,7 @@ import { ICodeEditor, IDiffEditor, isCodeEditor } from 'vs/editor/browser/editor
import { ServicesAccessor, registerEditorAction } from 'vs/editor/browser/editorExtensions';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IEditor, ScrollType } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ITextModel } from 'vs/editor/common/model';
import { BaseEditorQuickOpenAction, IDecorator } from 'vs/editor/standalone/browser/quickOpen/editorQuickOpen';
@@ -28,9 +28,9 @@ interface ParseResult {
export class GotoLineEntry extends QuickOpenEntry {
private readonly parseResult: ParseResult;
private readonly decorator: IDecorator;
private readonly editor: editorCommon.IEditor;
private readonly editor: IEditor;
constructor(line: string, editor: editorCommon.IEditor, decorator: IDecorator) {
constructor(line: string, editor: IEditor, decorator: IDecorator) {
super();
this.editor = editor;
@@ -108,7 +108,7 @@ export class GotoLineEntry extends QuickOpenEntry {
// Apply selection and focus
const range = this.toSelection();
(<ICodeEditor>this.editor).setSelection(range);
(<ICodeEditor>this.editor).revealRangeInCenter(range, editorCommon.ScrollType.Smooth);
(<ICodeEditor>this.editor).revealRangeInCenter(range, ScrollType.Smooth);
this.editor.focus();
return true;
@@ -124,7 +124,7 @@ export class GotoLineEntry extends QuickOpenEntry {
// Select Line Position
const range = this.toSelection();
this.editor.revealRangeInCenter(range, editorCommon.ScrollType.Smooth);
this.editor.revealRangeInCenter(range, ScrollType.Smooth);
// Decorate if possible
this.decorator.decorateLine(range, this.editor);

View File

@@ -18,9 +18,9 @@ import { isDiffEditorConfigurationKey, isEditorConfigurationKey } from 'vs/edito
import { EditOperation } from 'vs/editor/common/core/editOperation';
import { IPosition, Position as Pos } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IEditor } from 'vs/editor/common/editorCommon';
import { ITextModel, ITextSnapshot } from 'vs/editor/common/model';
import { TextEdit, WorkspaceEdit, isResourceTextEdit } from 'vs/editor/common/modes';
import { TextEdit, WorkspaceEdit, WorkspaceTextEdit } from 'vs/editor/common/modes';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IResolvedTextEditorModel, ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import { ITextResourceConfigurationService, ITextResourcePropertiesService, ITextResourceConfigurationChangeEvent } from 'vs/editor/common/services/textResourceConfigurationService';
@@ -80,13 +80,17 @@ export class SimpleModel implements IResolvedTextEditorModel {
public dispose(): void {
this._onDispose.fire();
}
public isResolved(): boolean {
return true;
}
}
export interface IOpenEditorDelegate {
(url: string): boolean;
}
function withTypedEditor<T>(widget: editorCommon.IEditor, codeEditorCallback: (editor: ICodeEditor) => T, diffEditorCallback: (editor: IDiffEditor) => T): T {
function withTypedEditor<T>(widget: IEditor, codeEditorCallback: (editor: ICodeEditor) => T, diffEditorCallback: (editor: IDiffEditor) => T): T {
if (isCodeEditor(widget)) {
// Single Editor
return codeEditorCallback(<ICodeEditor>widget);
@@ -100,13 +104,13 @@ export class SimpleEditorModelResolverService implements ITextModelService {
public _serviceBrand: undefined;
private readonly modelService: IModelService | undefined;
private editor?: editorCommon.IEditor;
private editor?: IEditor;
constructor(modelService: IModelService | undefined) {
this.modelService = modelService;
}
public setEditor(editor: editorCommon.IEditor): void {
public setEditor(editor: IEditor): void {
this.editor = editor;
}
@@ -631,13 +635,17 @@ export class SimpleBulkEditService implements IBulkEditService {
//
}
setPreviewHandler(): IDisposable {
return Disposable.None;
}
apply(workspaceEdit: WorkspaceEdit, options?: IBulkEditOptions): Promise<IBulkEditResult> {
let edits = new Map<ITextModel, TextEdit[]>();
if (workspaceEdit.edits) {
for (let edit of workspaceEdit.edits) {
if (!isResourceTextEdit(edit)) {
if (!WorkspaceTextEdit.is(edit)) {
return Promise.reject(new Error('bad edit - only text edits are supported'));
}
let model = this._modelService.getModel(edit.resource);

View File

@@ -77,10 +77,58 @@ export interface IActionDescriptor {
run(editor: ICodeEditor): void | Promise<void>;
}
/**
* Options which apply for all editors.
*/
export interface IGlobalEditorOptions {
/**
* The number of spaces a tab is equal to.
* This setting is overridden based on the file contents when `detectIndentation` is on.
* Defaults to 4.
*/
tabSize?: number;
/**
* Insert spaces when pressing `Tab`.
* This setting is overridden based on the file contents when detectIndentation` is on.
* Defaults to true.
*/
insertSpaces?: boolean;
/**
* Controls whether `tabSize` and `insertSpaces` will be automatically detected when a file is opened based on the file contents.
* Defaults to true.
*/
detectIndentation?: boolean;
/**
* Remove trailing auto inserted whitespace.
* Defaults to true.
*/
trimAutoWhitespace?: boolean;
/**
* Special handling for large files to disable certain memory intensive features.
* Defaults to true.
*/
largeFileOptimizations?: boolean;
/**
* Controls whether completions should be computed based on words in the document.
* Defaults to true.
*/
wordBasedSuggestions?: boolean;
/**
* Keep peek editors open even when double clicking their content or when hitting `Escape`.
* Defaults to false.
*/
stablePeek?: boolean;
/**
* Lines above this length will not be tokenized for performance reasons.
* Defaults to 20000.
*/
maxTokenizationLineLength?: number;
}
/**
* The options to create an editor.
*/
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions {
export interface IStandaloneEditorConstructionOptions extends IEditorConstructionOptions, IGlobalEditorOptions {
/**
* The initial model associated with this code editor.
*/
@@ -125,6 +173,7 @@ export interface IDiffEditorConstructionOptions extends IDiffEditorOptions {
}
export interface IStandaloneCodeEditor extends ICodeEditor {
updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void;
addCommand(keybinding: number, handler: ICommandHandler, context?: string): string | null;
createContextKey<T>(key: string, defaultValue: T): IContextKey<T>;
addAction(descriptor: IActionDescriptor): IDisposable;
@@ -337,7 +386,7 @@ export class StandaloneEditor extends StandaloneCodeEditor implements IStandalon
super.dispose();
}
public updateOptions(newOptions: IEditorOptions): void {
public updateOptions(newOptions: IEditorOptions & IGlobalEditorOptions): void {
applyConfigurationValues(this._configurationService, newOptions, false);
super.updateOptions(newOptions);
}

View File

@@ -10,10 +10,10 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { OpenerService } from 'vs/editor/browser/services/openerService';
import { DiffNavigator, IDiffNavigator } from 'vs/editor/browser/widget/diffNavigator';
import { ConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
import { EditorOptions, ConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
import { BareFontInfo, FontInfo } from 'vs/editor/common/config/fontInfo';
import { Token } from 'vs/editor/common/core/token';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IEditor, EditorType } from 'vs/editor/common/editorCommon';
import { FindMatch, ITextModel, TextModelResolvedOptions } from 'vs/editor/common/model';
import * as modes from 'vs/editor/common/modes';
import { NULL_STATE, nullTokenize } from 'vs/editor/common/modes/nullMode';
@@ -42,7 +42,7 @@ import { IEditorProgressService } from 'vs/platform/progress/common/progress';
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
function withAllStandaloneServices<T extends editorCommon.IEditor>(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T {
function withAllStandaloneServices<T extends IEditor>(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T {
let services = new DynamicStandaloneServices(domElement, override);
let simpleEditorModelResolverService: SimpleEditorModelResolverService | null = null;
@@ -346,19 +346,26 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
remeasureFonts: remeasureFonts,
// enums
ScrollbarVisibility: standaloneEnums.ScrollbarVisibility,
OverviewRulerLane: standaloneEnums.OverviewRulerLane,
MinimapPosition: standaloneEnums.MinimapPosition,
EndOfLinePreference: standaloneEnums.EndOfLinePreference,
DefaultEndOfLine: standaloneEnums.DefaultEndOfLine,
EndOfLineSequence: standaloneEnums.EndOfLineSequence,
TrackedRangeStickiness: standaloneEnums.TrackedRangeStickiness,
CursorChangeReason: standaloneEnums.CursorChangeReason,
MouseTargetType: standaloneEnums.MouseTargetType,
AccessibilitySupport: standaloneEnums.AccessibilitySupport,
ContentWidgetPositionPreference: standaloneEnums.ContentWidgetPositionPreference,
CursorChangeReason: standaloneEnums.CursorChangeReason,
DefaultEndOfLine: standaloneEnums.DefaultEndOfLine,
EditorAutoIndentStrategy: standaloneEnums.EditorAutoIndentStrategy,
EditorOption: standaloneEnums.EditorOption,
EndOfLinePreference: standaloneEnums.EndOfLinePreference,
EndOfLineSequence: standaloneEnums.EndOfLineSequence,
MinimapPosition: standaloneEnums.MinimapPosition,
MouseTargetType: standaloneEnums.MouseTargetType,
OverlayWidgetPositionPreference: standaloneEnums.OverlayWidgetPositionPreference,
OverviewRulerLane: standaloneEnums.OverviewRulerLane,
RenderLineNumbersType: standaloneEnums.RenderLineNumbersType,
RenderMinimap: standaloneEnums.RenderMinimap,
ScrollbarVisibility: standaloneEnums.ScrollbarVisibility,
ScrollType: standaloneEnums.ScrollType,
TextEditorCursorBlinkingStyle: standaloneEnums.TextEditorCursorBlinkingStyle,
TextEditorCursorStyle: standaloneEnums.TextEditorCursorStyle,
TrackedRangeStickiness: standaloneEnums.TrackedRangeStickiness,
WrappingIndent: standaloneEnums.WrappingIndent,
// classes
ConfigurationChangedEvent: <any>ConfigurationChangedEvent,
@@ -368,7 +375,8 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
FindMatch: <any>FindMatch,
// vars
EditorType: editorCommon.EditorType,
EditorType: EditorType,
EditorOptions: <any>EditorOptions
};
}