This commit is contained in:
Peng Lyu 2019-09-04 11:33:44 -07:00
parent 02fb6bfd43
commit 0a4ed9a829
5 changed files with 279 additions and 63 deletions

View file

@ -1,6 +1,6 @@
/*!-----------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Type definitions for monaco-editor v0.17.1
* Type definitions for monaco-editor v0.18.0
* Released under the MIT license
*-----------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------
@ -10,6 +10,8 @@
declare namespace monaco {
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export type Thenable<T> = PromiseLike<T>;
export interface IDisposable {
@ -32,7 +34,8 @@ declare namespace monaco {
export enum MarkerTag {
Unnecessary = 1
Unnecessary = 1,
Deprecated = 2
}
export enum MarkerSeverity {
@ -458,7 +461,7 @@ declare namespace monaco {
readonly column: number;
constructor(lineNumber: number, column: number);
/**
* Create a new postion from this position.
* Create a new position from this position.
*
* @param newLineNumber new line number
* @param newColumn new column
@ -588,6 +591,14 @@ declare namespace monaco {
* Test if `otherRange` is in `range`. If the ranges are equal, will return true.
*/
static containsRange(range: IRange, otherRange: IRange): boolean;
/**
* Test if `range` is strictly in this range. `range` must start after and end before this range for the result to be true.
*/
strictContainsRange(range: IRange): boolean;
/**
* Test if `otherRange` is strinctly in `range` (must start after, and end before). If the ranges are equal, will return false.
*/
static strictContainsRange(range: IRange, otherRange: IRange): boolean;
/**
* A reunion of the two ranges.
* The smallest position will be used as the start point, and the largest one as the end point.
@ -991,6 +1002,10 @@ declare namespace monaco.editor {
* A label to be used to identify the web worker for debugging purposes.
*/
label?: string;
/**
* An object that can be used by the web worker to make calls back to the main thread.
*/
host?: any;
}
/**
@ -1185,25 +1200,45 @@ declare namespace monaco.editor {
}
/**
* Options for rendering a model decoration in the overview ruler.
* Position in the minimap to render the decoration.
*/
export interface IModelDecorationOverviewRulerOptions {
export enum MinimapPosition {
Inline = 1
}
export interface IDecorationOptions {
/**
* CSS color to render in the overview ruler.
* CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
color: string | ThemeColor | undefined;
/**
* CSS color to render in the overview ruler.
* CSS color to render.
* e.g.: rgba(100, 100, 100, 0.5) or a color from the color registry
*/
darkColor?: string | ThemeColor;
}
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationOverviewRulerOptions extends IDecorationOptions {
/**
* The position in the overview ruler.
*/
position: OverviewRulerLane;
}
/**
* Options for rendering a model decoration in the overview ruler.
*/
export interface IModelDecorationMinimapOptions extends IDecorationOptions {
/**
* The position in the overview ruler.
*/
position: MinimapPosition;
}
/**
* Options for a model decoration.
*/
@ -1238,6 +1273,10 @@ declare namespace monaco.editor {
* If set, render this decoration in the overview ruler.
*/
overviewRuler?: IModelDecorationOverviewRulerOptions | null;
/**
* If set, render this decoration in the minimap.
*/
minimap?: IModelDecorationMinimapOptions | null;
/**
* If set, the decoration will be rendered in the glyph margin with this CSS class name.
*/
@ -2460,6 +2499,11 @@ declare namespace monaco.editor {
*/
export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';
/**
* Configuration options for typing over closing quotes or brackets
*/
export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
/**
* Configuration options for editor minimap
*/
@ -2615,6 +2659,11 @@ declare namespace monaco.editor {
* Defaults to true.
*/
lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* Controls the minimal number of visible leading and trailing lines surrounding the cursor.
* Defaults to 0.
*/
cursorSurroundingLines?: number;
/**
* Render last line number when the file ends with a newline.
* Defaults to true.
@ -2883,6 +2932,10 @@ declare namespace monaco.editor {
* Defaults to language defined behavior.
*/
autoClosingQuotes?: EditorAutoClosingStrategy;
/**
* Options for typing over closing quotes or brackets.
*/
autoClosingOvertype?: EditorAutoClosingOvertypeStrategy;
/**
* Options for auto surrounding.
* Defaults to always allowing auto surrounding.
@ -3008,7 +3061,7 @@ declare namespace monaco.editor {
* Enable rendering of whitespace.
* Defaults to none.
*/
renderWhitespace?: 'none' | 'boundary' | 'all';
renderWhitespace?: 'none' | 'boundary' | 'selection' | 'all';
/**
* Enable rendering of control characters.
* Defaults to false.
@ -3263,6 +3316,7 @@ declare namespace monaco.editor {
readonly ariaLabel: string;
readonly renderLineNumbers: RenderLineNumbersType;
readonly renderCustomLineNumbers: ((lineNumber: number) => string) | null;
readonly cursorSurroundingLines: number;
readonly renderFinalNewline: boolean;
readonly selectOnLineNumbers: boolean;
readonly glyphMargin: boolean;
@ -3280,7 +3334,7 @@ declare namespace monaco.editor {
readonly scrollBeyondLastColumn: number;
readonly smoothScrolling: boolean;
readonly stopRenderingLineAfter: number;
readonly renderWhitespace: 'none' | 'boundary' | 'all';
readonly renderWhitespace: 'none' | 'boundary' | 'selection' | 'all';
readonly renderControlCharacters: boolean;
readonly fontLigatures: boolean;
readonly renderIndentGuides: boolean;
@ -3345,6 +3399,7 @@ declare namespace monaco.editor {
readonly wordSeparators: string;
readonly autoClosingBrackets: EditorAutoClosingStrategy;
readonly autoClosingQuotes: EditorAutoClosingStrategy;
readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy;
readonly autoSurround: EditorAutoSurroundStrategy;
readonly autoIndent: boolean;
readonly useTabStops: boolean;
@ -3486,6 +3541,7 @@ declare namespace monaco.editor {
readonly wordSeparators: boolean;
readonly autoClosingBrackets: boolean;
readonly autoClosingQuotes: boolean;
readonly autoClosingOvertype: boolean;
readonly autoSurround: boolean;
readonly autoIndent: boolean;
readonly useTabStops: boolean;
@ -3565,17 +3621,17 @@ declare namespace monaco.editor {
* @param zone Zone to create
* @return A unique identifier to the view zone.
*/
addZone(zone: IViewZone): number;
addZone(zone: IViewZone): string;
/**
* Remove a zone
* @param id A unique identifier to the view zone, as returned by the `addZone` call.
*/
removeZone(id: number): void;
removeZone(id: string): void;
/**
* Change a zone's position.
* The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone.
*/
layoutZone(id: number): void;
layoutZone(id: string): void;
}
/**
@ -4014,7 +4070,7 @@ declare namespace monaco.editor {
* @param edits The edits to execute.
* @param endCursorState Cursor state after the edits were applied.
*/
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: Selection[]): boolean;
executeEdits(source: string, edits: IIdentifiedSingleEditOperation[], endCursorState?: ICursorStateComputer | Selection[]): boolean;
/**
* Execute multiple (concomitant) commands on the editor.
* @param source The source of the call.
@ -4276,7 +4332,7 @@ declare namespace monaco.languages {
* - f = foreground ColorId (9 bits)
* - b = background ColorId (9 bits)
* - The color value for each colorId is defined in IStandaloneThemeData.customTokenColors:
* e.g colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
* e.g. colorId = 1 is stored in IStandaloneThemeData.customTokenColors[1]. Color id = 0 means no color,
* id = 1 is for the default foreground color, id = 2 for the default background.
*/
tokens: Uint32Array;
@ -4415,6 +4471,16 @@ declare namespace monaco.languages {
*/
export function registerFoldingRangeProvider(languageId: string, provider: FoldingRangeProvider): IDisposable;
/**
* Register a declaration provider
*/
export function registerDeclarationProvider(languageId: string, provider: DeclarationProvider): IDisposable;
/**
* Register a selection range provider
*/
export function registerSelectionRangeProvider(languageId: string, provider: SelectionRangeProvider): IDisposable;
/**
* Contains additional diagnostic information about the context in which
* a [code action](#CodeActionProvider.provideCodeActions) is run.
@ -4438,7 +4504,7 @@ declare namespace monaco.languages {
/**
* Provide commands for the given document and range.
*/
provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): (Command | CodeAction)[] | Promise<(Command | CodeAction)[]>;
provideCodeActions(model: editor.ITextModel, range: Range, context: CodeActionContext, token: CancellationToken): CodeActionList | Promise<CodeActionList>;
}
/**
@ -4511,7 +4577,9 @@ declare namespace monaco.languages {
*
* @deprecated Will be replaced by a better API soon.
*/
__electricCharacterSupport?: IBracketElectricCharacterContribution;
__electricCharacterSupport?: {
docComment?: IDocComment;
};
}
/**
@ -4586,10 +4654,6 @@ declare namespace monaco.languages {
action: EnterAction;
}
export interface IBracketElectricCharacterContribution {
docComment?: IDocComment;
}
/**
* Definition of documentation comments (e.g. Javadoc/JSdoc)
*/
@ -4738,6 +4802,10 @@ declare namespace monaco.languages {
Snippet = 25
}
export enum CompletionItemTag {
Deprecated = 1
}
export enum CompletionItemInsertTextRule {
/**
* Adjust whitespace/indentation of multiline insert texts to
@ -4766,6 +4834,11 @@ declare namespace monaco.languages {
* an icon is chosen by the editor.
*/
kind: CompletionItemKind;
/**
* A modifier to the `kind` which affect how the item
* is rendered, e.g. Deprecated is rendered with a strikeout
*/
tags?: ReadonlyArray<CompletionItemTag>;
/**
* A human-readable string with additional information
* about this item, like type or symbol information.
@ -4899,6 +4972,10 @@ declare namespace monaco.languages {
isPreferred?: boolean;
}
export interface CodeActionList extends IDisposable {
readonly actions: ReadonlyArray<CodeAction>;
}
/**
* Represents a parameter of a callable-signature. A parameter can
* have a label and a doc-comment.
@ -4958,6 +5035,10 @@ declare namespace monaco.languages {
activeParameter: number;
}
export interface SignatureHelpResult extends IDisposable {
value: SignatureHelp;
}
export enum SignatureHelpTriggerKind {
Invoke = 1,
TriggerCharacter = 2,
@ -4981,7 +5062,7 @@ declare namespace monaco.languages {
/**
* Provide help for the signature at the given position and document.
*/
provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelp>;
provideSignatureHelp(model: editor.ITextModel, position: Position, token: CancellationToken, context: SignatureHelpContext): ProviderResult<SignatureHelpResult>;
}
/**
@ -5167,10 +5248,15 @@ declare namespace monaco.languages {
TypeParameter = 25
}
export enum SymbolTag {
Deprecated = 1
}
export interface DocumentSymbol {
name: string;
detail: string;
kind: SymbolKind;
tags: ReadonlyArray<SymbolTag>;
containerName?: string;
range: IRange;
selectionRange: IRange;
@ -5259,6 +5345,7 @@ declare namespace monaco.languages {
export interface ILink {
range: IRange;
url?: Uri | string;
tooltip?: string;
}
export interface ILinksList {
@ -5347,7 +5434,6 @@ declare namespace monaco.languages {
}
export interface SelectionRange {
kind: string;
range: IRange;
}
@ -5454,16 +5540,21 @@ declare namespace monaco.languages {
arguments?: any[];
}
export interface ICodeLensSymbol {
export interface CodeLens {
range: IRange;
id?: string;
command?: Command;
}
export interface CodeLensList {
lenses: CodeLens[];
dispose(): void;
}
export interface CodeLensProvider {
onDidChange?: IEvent<this>;
provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<ICodeLensSymbol[]>;
resolveCodeLens?(model: editor.ITextModel, codeLens: ICodeLensSymbol, token: CancellationToken): ProviderResult<ICodeLensSymbol>;
provideCodeLenses(model: editor.ITextModel, token: CancellationToken): ProviderResult<CodeLensList>;
resolveCodeLens?(model: editor.ITextModel, codeLens: CodeLens, token: CancellationToken): ProviderResult<CodeLens>;
}
export interface ILanguageExtensionPoint {
@ -5611,7 +5702,11 @@ declare namespace monaco.worker {
getValue(): string;
}
export interface IWorkerContext {
export interface IWorkerContext<H = undefined> {
/**
* A proxy to the main thread host object.
*/
host: H;
/**
* Get all available mirror models in this worker.
*/