Adopt latest monaco-editor-core

This commit is contained in:
Alex Dima 2022-01-10 09:07:20 +01:00
parent a385674a34
commit 3159d3d6c9
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
6 changed files with 272 additions and 47 deletions

View file

@ -1506,6 +1506,11 @@ declare namespace monaco.editor {
* If there is an `inlineClassName` which affects letter spacing.
*/
readonly inlineClassNameAffectsLetterSpacing?: boolean;
/**
* This field allows to attach data to this injected text.
* The data can be read when injected texts at a given position are queried.
*/
readonly attachedData?: unknown;
}
/**
@ -3305,6 +3310,7 @@ declare namespace monaco.editor {
*/
guides?: IGuidesOptions;
unicodeHighlight?: IUnicodeHighlightOptions;
bracketPairColorization?: IBracketPairColorizationOptions;
}
export interface IDiffEditorBaseOptions {
@ -3379,8 +3385,8 @@ declare namespace monaco.editor {
get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
}
export interface IEditorOption<K1 extends EditorOption, V> {
readonly id: K1;
export interface IEditorOption<K extends EditorOption, V> {
readonly id: K;
readonly name: string;
defaultValue: V;
/**
@ -4541,6 +4547,9 @@ declare namespace monaco.editor {
* Render this content widget in a location where it could overflow the editor's view dom node.
*/
allowEditorOverflow?: boolean;
/**
* Call preventDefault() on mousedown events that target the content widget.
*/
suppressMouseDown?: boolean;
/**
* Get a unique identifier of the content widget.
@ -4678,18 +4687,11 @@ declare namespace monaco.editor {
OUTSIDE_EDITOR = 13
}
/**
* Target hit with the mouse in the editor.
*/
export interface IMouseTarget {
export interface IBaseMouseTarget {
/**
* The target element
*/
readonly element: Element | null;
/**
* The target type
*/
readonly type: MouseTargetType;
/**
* The 'approximate' editor position
*/
@ -4702,12 +4704,104 @@ declare namespace monaco.editor {
* The 'approximate' editor range
*/
readonly range: Range | null;
/**
* Some extra detail.
*/
readonly detail: any;
}
export interface IMouseTargetUnknown extends IBaseMouseTarget {
readonly type: MouseTargetType.UNKNOWN;
}
export interface IMouseTargetTextarea extends IBaseMouseTarget {
readonly type: MouseTargetType.TEXTAREA;
readonly position: null;
readonly range: null;
}
export interface IMouseTargetMarginData {
readonly isAfterLines: boolean;
readonly glyphMarginLeft: number;
readonly glyphMarginWidth: number;
readonly lineNumbersWidth: number;
readonly offsetX: number;
}
export interface IMouseTargetMargin extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetMarginData;
}
export interface IMouseTargetViewZoneData {
readonly viewZoneId: string;
readonly positionBefore: Position | null;
readonly positionAfter: Position | null;
readonly position: Position;
readonly afterLineNumber: number;
}
export interface IMouseTargetViewZone extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetViewZoneData;
}
export interface IMouseTargetContentTextData {
readonly mightBeForeignElement: boolean;
}
export interface IMouseTargetContentText extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_TEXT;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentTextData;
}
export interface IMouseTargetContentEmptyData {
readonly isAfterLines: boolean;
readonly horizontalDistanceToText?: number;
}
export interface IMouseTargetContentEmpty extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_EMPTY;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentEmptyData;
}
export interface IMouseTargetContentWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetOverlayWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERLAY_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetScrollbar extends IBaseMouseTarget {
readonly type: MouseTargetType.SCROLLBAR;
readonly position: Position;
readonly range: Range;
}
export interface IMouseTargetOverviewRuler extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERVIEW_RULER;
}
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
readonly type: MouseTargetType.OUTSIDE_EDITOR;
}
/**
* Target hit with the mouse in the editor.
*/
export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor);
/**
* A mouse event originating from the editor.
*/
@ -5041,6 +5135,10 @@ declare namespace monaco.editor {
* Get all the decorations on a line (filtering out decorations from other editors).
*/
getLineDecorations(lineNumber: number): IModelDecoration[] | null;
/**
* Get all the decorations for a range (filtering out decorations from other editors).
*/
getDecorationsInRange(range: Range): IModelDecoration[] | null;
/**
* All decorations added through this call will get the ownerId of this editor.
* @see {@link ITextModel.deltaDecorations}
@ -5149,9 +5247,9 @@ declare namespace monaco.editor {
*/
export interface IDiffEditor extends IEditor {
/**
* @see {@link ICodeEditor.getDomNode}
* @see {@link ICodeEditor.getContainerDomNode}
*/
getDomNode(): HTMLElement;
getContainerDomNode(): HTMLElement;
/**
* An event emitted when the diff information computed by this diff editor has been updated.
* @event
@ -5253,7 +5351,7 @@ declare namespace monaco.languages {
export function getEncodedLanguageId(languageId: string): number;
/**
* An event emitted when a language is first time needed (e.g. a model has it set).
* An event emitted when a language is needed for the first time (e.g. a model has it set).
* @event
*/
export function onLanguage(languageId: string, callback: () => void): IDisposable;
@ -6751,17 +6849,30 @@ declare namespace monaco.languages {
Parameter = 2
}
export interface InlayHintLabelPart {
label: string;
collapsible?: boolean;
action?: Command | Location;
}
export interface InlayHint {
text: string;
label: string | InlayHintLabelPart[];
tooltip?: string | IMarkdownString;
position: IPosition;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}
export interface InlayHintList {
hints: InlayHint[];
dispose(): void;
}
export interface InlayHintsProvider {
onDidChangeInlayHints?: IEvent<void>;
provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHint[]>;
provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;
resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;
}
export interface SemanticTokensLegend {

View file

@ -1506,6 +1506,11 @@ declare namespace monaco.editor {
* If there is an `inlineClassName` which affects letter spacing.
*/
readonly inlineClassNameAffectsLetterSpacing?: boolean;
/**
* This field allows to attach data to this injected text.
* The data can be read when injected texts at a given position are queried.
*/
readonly attachedData?: unknown;
}
/**
@ -3305,6 +3310,7 @@ declare namespace monaco.editor {
*/
guides?: IGuidesOptions;
unicodeHighlight?: IUnicodeHighlightOptions;
bracketPairColorization?: IBracketPairColorizationOptions;
}
export interface IDiffEditorBaseOptions {
@ -3379,8 +3385,8 @@ declare namespace monaco.editor {
get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
}
export interface IEditorOption<K1 extends EditorOption, V> {
readonly id: K1;
export interface IEditorOption<K extends EditorOption, V> {
readonly id: K;
readonly name: string;
defaultValue: V;
/**
@ -4541,6 +4547,9 @@ declare namespace monaco.editor {
* Render this content widget in a location where it could overflow the editor's view dom node.
*/
allowEditorOverflow?: boolean;
/**
* Call preventDefault() on mousedown events that target the content widget.
*/
suppressMouseDown?: boolean;
/**
* Get a unique identifier of the content widget.
@ -4678,18 +4687,11 @@ declare namespace monaco.editor {
OUTSIDE_EDITOR = 13
}
/**
* Target hit with the mouse in the editor.
*/
export interface IMouseTarget {
export interface IBaseMouseTarget {
/**
* The target element
*/
readonly element: Element | null;
/**
* The target type
*/
readonly type: MouseTargetType;
/**
* The 'approximate' editor position
*/
@ -4702,12 +4704,104 @@ declare namespace monaco.editor {
* The 'approximate' editor range
*/
readonly range: Range | null;
/**
* Some extra detail.
*/
readonly detail: any;
}
export interface IMouseTargetUnknown extends IBaseMouseTarget {
readonly type: MouseTargetType.UNKNOWN;
}
export interface IMouseTargetTextarea extends IBaseMouseTarget {
readonly type: MouseTargetType.TEXTAREA;
readonly position: null;
readonly range: null;
}
export interface IMouseTargetMarginData {
readonly isAfterLines: boolean;
readonly glyphMarginLeft: number;
readonly glyphMarginWidth: number;
readonly lineNumbersWidth: number;
readonly offsetX: number;
}
export interface IMouseTargetMargin extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_GLYPH_MARGIN | MouseTargetType.GUTTER_LINE_NUMBERS | MouseTargetType.GUTTER_LINE_DECORATIONS;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetMarginData;
}
export interface IMouseTargetViewZoneData {
readonly viewZoneId: string;
readonly positionBefore: Position | null;
readonly positionAfter: Position | null;
readonly position: Position;
readonly afterLineNumber: number;
}
export interface IMouseTargetViewZone extends IBaseMouseTarget {
readonly type: MouseTargetType.GUTTER_VIEW_ZONE | MouseTargetType.CONTENT_VIEW_ZONE;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetViewZoneData;
}
export interface IMouseTargetContentTextData {
readonly mightBeForeignElement: boolean;
}
export interface IMouseTargetContentText extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_TEXT;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentTextData;
}
export interface IMouseTargetContentEmptyData {
readonly isAfterLines: boolean;
readonly horizontalDistanceToText?: number;
}
export interface IMouseTargetContentEmpty extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_EMPTY;
readonly position: Position;
readonly range: Range;
readonly detail: IMouseTargetContentEmptyData;
}
export interface IMouseTargetContentWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.CONTENT_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetOverlayWidget extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERLAY_WIDGET;
readonly position: null;
readonly range: null;
readonly detail: string;
}
export interface IMouseTargetScrollbar extends IBaseMouseTarget {
readonly type: MouseTargetType.SCROLLBAR;
readonly position: Position;
readonly range: Range;
}
export interface IMouseTargetOverviewRuler extends IBaseMouseTarget {
readonly type: MouseTargetType.OVERVIEW_RULER;
}
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
readonly type: MouseTargetType.OUTSIDE_EDITOR;
}
/**
* Target hit with the mouse in the editor.
*/
export type IMouseTarget = (IMouseTargetUnknown | IMouseTargetTextarea | IMouseTargetMargin | IMouseTargetViewZone | IMouseTargetContentText | IMouseTargetContentEmpty | IMouseTargetContentWidget | IMouseTargetOverlayWidget | IMouseTargetScrollbar | IMouseTargetOverviewRuler | IMouseTargetOutsideEditor);
/**
* A mouse event originating from the editor.
*/
@ -5041,6 +5135,10 @@ declare namespace monaco.editor {
* Get all the decorations on a line (filtering out decorations from other editors).
*/
getLineDecorations(lineNumber: number): IModelDecoration[] | null;
/**
* Get all the decorations for a range (filtering out decorations from other editors).
*/
getDecorationsInRange(range: Range): IModelDecoration[] | null;
/**
* All decorations added through this call will get the ownerId of this editor.
* @see {@link ITextModel.deltaDecorations}
@ -5149,9 +5247,9 @@ declare namespace monaco.editor {
*/
export interface IDiffEditor extends IEditor {
/**
* @see {@link ICodeEditor.getDomNode}
* @see {@link ICodeEditor.getContainerDomNode}
*/
getDomNode(): HTMLElement;
getContainerDomNode(): HTMLElement;
/**
* An event emitted when the diff information computed by this diff editor has been updated.
* @event
@ -5253,7 +5351,7 @@ declare namespace monaco.languages {
export function getEncodedLanguageId(languageId: string): number;
/**
* An event emitted when a language is first time needed (e.g. a model has it set).
* An event emitted when a language is needed for the first time (e.g. a model has it set).
* @event
*/
export function onLanguage(languageId: string, callback: () => void): IDisposable;
@ -6751,17 +6849,30 @@ declare namespace monaco.languages {
Parameter = 2
}
export interface InlayHintLabelPart {
label: string;
collapsible?: boolean;
action?: Command | Location;
}
export interface InlayHint {
text: string;
label: string | InlayHintLabelPart[];
tooltip?: string | IMarkdownString;
position: IPosition;
kind: InlayHintKind;
whitespaceBefore?: boolean;
whitespaceAfter?: boolean;
}
export interface InlayHintList {
hints: InlayHint[];
dispose(): void;
}
export interface InlayHintsProvider {
onDidChangeInlayHints?: IEvent<void>;
provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHint[]>;
provideInlayHints(model: editor.ITextModel, range: Range, token: CancellationToken): ProviderResult<InlayHintList>;
resolveInlayHint?(hint: InlayHint, token: CancellationToken): ProviderResult<InlayHint>;
}
export interface SemanticTokensLegend {