diff --git a/build/monaco/README.md b/build/monaco/README.md new file mode 100644 index 0000000000000000000000000000000000000000..064b9dda1d3648f4e1656d226e8620786f895c90 --- /dev/null +++ b/build/monaco/README.md @@ -0,0 +1,25 @@ +# Steps to publish a new version of monaco-editor-core + +## Generate monaco.d.ts + +* Generate `.d.ts` files from our modules + * kill `gulp watch` if you have it running + * `SET VSCODE_BUILD_DECLARATION_FILES=1` + * run `gulp watch` +* `node build/lib/api` +* validate that the file is generated ok and that everything compiles + +## Bump version + +* increase version in `build/monaco/package.json` + +## Generate npm contents for monaco-editor-core + +* Be sure to have all changes committed **and pushed to the remote** +* (the generated files contain the HEAD sha and that should be available on the remote) +* run gulp editor-distro + +## Publish + +* `cd out-monaco-editor-core` +* `npm publish` diff --git a/build/monaco/monaco.d.ts.recipe b/build/monaco/monaco.d.ts.recipe index f8f1ac48a46090237b759ef54426460da8aa09df..5079cf2ec3c9cb81bc814905c27e8d3a745d2f13 100644 --- a/build/monaco/monaco.d.ts.recipe +++ b/build/monaco/monaco.d.ts.recipe @@ -1,46 +1,3 @@ - -declare module monaco.worker { - - export interface IMirrorModel { - uri: Uri; - version: number; - getText(): string; - } - - export var mirrorModels: IMirrorModel[]; - -} - -declare module monaco.languages { - -#includeAll(vs/editor/browser/standalone/standaloneLanguages;modes.=>;editorCommon.=>editor.): -#include(vs/editor/common/modes/supports/richEditSupport): CommentRule, IRichLanguageConfiguration -#include(vs/editor/common/modes/supports/onEnter): IIndentationRules, IOnEnterRegExpRules -#include(vs/editor/common/modes/supports/electricCharacter): IBracketElectricCharacterContribution, IDocComment -#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IToken2=>IToken;ILineTokens2=>ILineTokens;IState2=>IState): -#include(vs/editor/common/services/modeService): ILanguageExtensionPoint - -} - - -declare module monaco.editor { - -#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.): -#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions -#include(vs/editor/browser/standalone/standaloneServices): IEditorOverrideServices -#include(vs/platform/markers/common/markers): IMarkerData - - export interface IColorizerOptions { - tabSize?: number; - } - - export interface IColorizerElementOptions extends IColorizerOptions { - theme?: string; - mimeType?: string; - } -} - - declare module monaco { interface Thenable { @@ -92,10 +49,47 @@ declare module monaco { #include(vs/editor/common/core/selection): Selection } - declare module monaco.editor { + +#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.): +#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions +#include(vs/editor/browser/standalone/standaloneServices): IEditorOverrideServices +#include(vs/platform/markers/common/markers): IMarkerData + + export interface IColorizerOptions { + tabSize?: number; + } + + export interface IColorizerElementOptions extends IColorizerOptions { + theme?: string; + mimeType?: string; + } + #include(vs/editor/common/modes/monarch/monarchTypes): ILanguage, ILanguageBracket #include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility #includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode): IPosition, IRange, ISelection, SelectionDirection, IScrollEvent #includeAll(vs/editor/browser/editorBrowser;editorCommon.=>): +} + +declare module monaco.languages { + +#includeAll(vs/editor/browser/standalone/standaloneLanguages;modes.=>;editorCommon.=>editor.): +#include(vs/editor/common/modes/supports/richEditSupport): CommentRule, IRichLanguageConfiguration +#include(vs/editor/common/modes/supports/onEnter): IIndentationRules, IOnEnterRegExpRules +#include(vs/editor/common/modes/supports/electricCharacter): IBracketElectricCharacterContribution, IDocComment +#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IToken2=>IToken;ILineTokens2=>ILineTokens;IState2=>IState): +#include(vs/editor/common/services/modeService): ILanguageExtensionPoint + +} + +declare module monaco.worker { + + export interface IMirrorModel { + uri: Uri; + version: number; + getText(): string; + } + + export var mirrorModels: IMirrorModel[]; + } \ No newline at end of file diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 21889320896ed691615c4dc0a3543429bcf5c755..d6fc3dcd6ce36c5be7faed549e2beddf958fa970 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -1,590 +1,117 @@ +declare module monaco { -declare module monaco.worker { - - export interface IMirrorModel { - uri: Uri; - version: number; - getText(): string; + interface Thenable { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable; + then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable; } - export var mirrorModels: IMirrorModel[]; - -} - -declare module monaco.languages { - - - export function setLanguageConfiguration(languageId: string, configuration: IRichLanguageConfiguration): IDisposable; - - export function setTokensProvider(languageId: string, support: TokensProvider): IDisposable; - - export function registerReferenceProvider(languageId: string, support: ReferenceProvider): IDisposable; - - export function registerRenameProvider(languageId: string, support: RenameProvider): IDisposable; - - export enum CompletionItemKind { - Text = 0, - Method = 1, - Function = 2, - Constructor = 3, - Field = 4, - Variable = 5, - Class = 6, - Interface = 7, - Module = 8, - Property = 9, - Unit = 10, - Value = 11, - Enum = 12, - Keyword = 13, - Snippet = 14, - Color = 15, - File = 16, - Reference = 17, + export interface IDisposable { + dispose(): void; } - export interface CompletionItem { - label: string; - kind: CompletionItemKind; - detail?: string; - documentation?: string; - sortText?: string; - filterText?: string; - insertText?: string; - textEdit?: editor.ISingleEditOperation; + export interface IEvent { + (listener: (e: T) => any, thisArg?: any): IDisposable; } - export interface CompletionList { - isIncomplete?: boolean; - items: CompletionItem[]; + export class Emitter { + constructor(); + event: IEvent; + fire(event?: T): void; + dispose(): void; } - export interface CompletionItemProvider { - triggerCharacters?: string[]; - provideCompletionItems(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): CompletionItem[] | Thenable | CompletionList | Thenable; - resolveCompletionItem?(item: CompletionItem, token: CancellationToken): CompletionItem | Thenable; + export enum Severity { + Ignore = 0, + Info = 1, + Warning = 2, + Error = 3, } - export function registerCompletionItemProvider(languageId: string, provider: CompletionItemProvider): IDisposable; - - export function registerSignatureHelpProvider(languageId: string, support: SignatureHelpProvider): IDisposable; - - export function registerHoverProvider(languageId: string, support: HoverProvider): IDisposable; - - export function registerDocumentSymbolProvider(languageId: string, support: DocumentSymbolProvider): IDisposable; - - export function registerDocumentHighlightProvider(languageId: string, support: DocumentHighlightProvider): IDisposable; - - export function registerDefinitionProvider(languageId: string, support: DefinitionProvider): IDisposable; - - export function registerCodeLensProvider(languageId: string, support: CodeLensProvider): IDisposable; - - export function registerCodeActionProvider(languageId: string, support: CodeActionProvider): IDisposable; - - export function registerDocumentFormattingEditProvider(languageId: string, support: DocumentFormattingEditProvider): IDisposable; - - export function registerDocumentRangeFormattingEditProvider(languageId: string, support: DocumentRangeFormattingEditProvider): IDisposable; - - export function registerOnTypeFormattingEditProvider(languageId: string, support: OnTypeFormattingEditProvider): IDisposable; - - export function registerLinkProvider(languageId: string, support: LinkProvider): IDisposable; - - export function registerMonarchStandaloneLanguage(language: ILanguageExtensionPoint, defModule: string): void; - - export function register(language: ILanguageExtensionPoint): void; - export function onLanguage(languageId: string, callback: () => void): IDisposable; - export interface CommentRule { - lineComment?: string; - blockComment?: CharacterPair; + // --- Generic promise + export interface TValueCallback { + (value: T): void; } - export interface IRichLanguageConfiguration { - comments?: CommentRule; - brackets?: CharacterPair[]; - wordPattern?: RegExp; - indentationRules?: IIndentationRules; - onEnterRules?: IOnEnterRegExpRules[]; - autoClosingPairs?: IAutoClosingPairConditional[]; - surroundingPairs?: IAutoClosingPair[]; - __electricCharacterSupport?: IBracketElectricCharacterContribution; - } - export interface IIndentationRules { - decreaseIndentPattern: RegExp; - increaseIndentPattern: RegExp; - indentNextLinePattern?: RegExp; - unIndentedLinePattern?: RegExp; + export interface ProgressCallback { + (progress: any): any; } - export interface IOnEnterRegExpRules { - beforeText: RegExp; - afterText?: RegExp; - action: IEnterAction; - } - export interface IBracketElectricCharacterContribution { - docComment?: IDocComment; - caseInsensitive?: boolean; - embeddedElectricCharacters?: string[]; - } + export class Promise { - /** - * Definition of documentation comments (e.g. Javadoc/JSdoc) - */ - export interface IDocComment { - scope: string; - open: string; - lineStart: string; - close?: string; - } + constructor(init: (complete: TValueCallback, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any); - export interface IMode { - getId(): string; - } + public then(success?: (value: V) => Promise, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise, error?: (err: any) => U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise, error?: (err: any) => void, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise | U, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise | U, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise | U, error?: (err: any) => U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => Promise | U, error?: (err: any) => void, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => U, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => U, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): Promise; + public then(success?: (value: V) => U, error?: (err: any) => void, progress?: ProgressCallback): Promise; - export interface IToken { - startIndex: number; - scopes: string | string[]; - } + public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void; + public cancel(): void; - export interface ILineTokens { - tokens: IToken[]; - endState: IState; - retokenize?: Promise; + public static as(value: ValueType): Promise; + public static is(value: any): value is Promise; + public static timeout(delay: number): Promise; + public static join(promises: Promise[]): Promise; + public static join(promises: Thenable[]): Thenable; + public static join(promises: { [n: string]: Promise }): Promise<{ [n: string]: ValueType }>; + public static any(promises: Promise[]): Promise<{ key: string; value: Promise; }>; + public static wrapError(error: any): Promise; } - export interface IState { - clone(): IState; - equals(other: IState): boolean; + export class CancellationTokenSource { + token: CancellationToken; + cancel(): void; + dispose(): void; } - export interface TokensProvider { - getInitialState(): IState; - tokenize(line: string, state: IState): ILineTokens; + export interface CancellationToken { + isCancellationRequested: boolean; + onCancellationRequested: IEvent; } - /** - * A hover represents additional information for a symbol or word. Hovers are - * rendered in a tooltip-like widget. + * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986. + * This class is a simple parser which creates the basic component paths + * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation + * and encoding. + * + * foo://example.com:8042/over/there?name=ferret#nose + * \_/ \______________/\_________/ \_________/ \__/ + * | | | | | + * scheme authority path query fragment + * | _____________________|__ + * / \ / \ + * urn:example:animal:ferret:nose + * + * */ - export interface Hover { + export class Uri { + constructor(); /** - * The contents of this hover. + * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. + * The part before the first colon. */ - htmlContent: IHTMLContentElement[]; + scheme: string; /** - * The range to which this hover applies. When missing, the - * editor will use the range at the current position or the - * current position itself. - */ - range: IRange; - } - - export interface HoverProvider { - provideHover(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Hover | Thenable; - } - - /** - * Interface used to quick fix typing errors while accesing member fields. - */ - export interface IQuickFix { - command: ICommand; - score: number; - } - - export interface CodeActionProvider { - provideCodeActions(model: editor.IReadOnlyModel, range: Range, token: CancellationToken): IQuickFix[] | Thenable; - } - - export interface ParameterInformation { - label: string; - documentation: string; - } - - export interface SignatureInformation { - label: string; - documentation: string; - parameters: ParameterInformation[]; - } - - export interface SignatureHelp { - signatures: SignatureInformation[]; - activeSignature: number; - activeParameter: number; - } - - export interface SignatureHelpProvider { - signatureHelpTriggerCharacters: string[]; - provideSignatureHelp(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): SignatureHelp | Thenable; - } - - export enum DocumentHighlightKind { - Text = 0, - Read = 1, - Write = 2, - } - - export interface DocumentHighlight { - range: IRange; - kind: DocumentHighlightKind; - } - - export interface DocumentHighlightProvider { - provideDocumentHighlights(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable; - } - - export interface ReferenceContext { - includeDeclaration: boolean; - } - - export interface ReferenceProvider { - provideReferences(model: editor.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable; - } - - export class Location { - uri: Uri; - range: IRange; - } - - export type Definition = Location | Location[]; - - export interface DefinitionProvider { - provideDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable; - } - - export enum SymbolKind { - File = 0, - Module = 1, - Namespace = 2, - Package = 3, - Class = 4, - Method = 5, - Property = 6, - Field = 7, - Constructor = 8, - Enum = 9, - Interface = 10, - Function = 11, - Variable = 12, - Constant = 13, - String = 14, - Number = 15, - Boolean = 16, - Array = 17, - Object = 18, - Key = 19, - Null = 20, - } - - export interface SymbolInformation { - name: string; - containerName?: string; - kind: SymbolKind; - location: Location; - } - - export interface DocumentSymbolProvider { - provideDocumentSymbols(model: editor.IReadOnlyModel, token: CancellationToken): SymbolInformation[] | Thenable; - } - - /** - * Interface used to format a model - */ - export interface IFormattingOptions { - tabSize: number; - insertSpaces: boolean; - } - - export interface DocumentFormattingEditProvider { - provideDocumentFormattingEdits(model: editor.IReadOnlyModel, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; - } - - export interface DocumentRangeFormattingEditProvider { - provideDocumentRangeFormattingEdits(model: editor.IReadOnlyModel, range: Range, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; - } - - export interface OnTypeFormattingEditProvider { - autoFormatTriggerCharacters: string[]; - provideOnTypeFormattingEdits(model: editor.IReadOnlyModel, position: Position, ch: string, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; - } - - export interface ILink { - range: IRange; - url: string; - } - - export interface LinkProvider { - provideLinks(model: editor.IReadOnlyModel, token: CancellationToken): ILink[] | Thenable; - } - - export interface IResourceEdit { - resource: Uri; - range: IRange; - newText: string; - } - - export interface WorkspaceEdit { - edits: IResourceEdit[]; - rejectReason?: string; - } - - export interface RenameProvider { - provideRenameEdits(model: editor.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable; - } - - export interface ICommand { - id: string; - title: string; - arguments?: any[]; - } - - export interface ICodeLensSymbol { - range: IRange; - id?: string; - command?: ICommand; - } - - export interface CodeLensProvider { - provideCodeLenses(model: editor.IReadOnlyModel, token: CancellationToken): ICodeLensSymbol[] | Thenable; - resolveCodeLens?(model: editor.IReadOnlyModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable; - } - - export type CharacterPair = [string, string]; - - export interface IAutoClosingPairConditional extends IAutoClosingPair { - notIn?: string[]; - } - - export enum IndentAction { - None = 0, - Indent = 1, - IndentOutdent = 2, - Outdent = 3, - } - - /** - * An action the editor executes when 'enter' is being pressed - */ - export interface IEnterAction { - indentAction: IndentAction; - appendText?: string; - removeText?: number; - } - - export interface IAutoClosingPair { - open: string; - close: string; - } - - export interface ILanguageExtensionPoint { - id: string; - extensions?: string[]; - filenames?: string[]; - filenamePatterns?: string[]; - firstLine?: string; - aliases?: string[]; - mimetypes?: string[]; - configuration?: string; - } - -} - - -declare module monaco.editor { - - - export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services: IEditorOverrideServices): ICodeEditor; - - export function createDiffEditor(domElement: HTMLElement, options: IDiffEditorConstructionOptions, services: IEditorOverrideServices): IDiffEditor; - - export function createModel(value: string, mode: string | ILanguage | languages.IMode, associatedResource?: Uri | string): IModel; - - export function getModels(): IModel[]; - - export function getModel(uri: Uri): IModel; - - export function onDidCreateModel(listener: (model: IModel) => void): IDisposable; - - export function onWillDisposeModel(listener: (model: IModel) => void): IDisposable; - - export function onDidChangeModelMode(listener: (e: { - model: IModel; - oldModeId: string; - }) => void): IDisposable; - - export function setMarkers(model: IModel, owner: string, markers: IMarkerData[]): void; - - export function getOrCreateMode(modeId: string): Promise; - - export function createCustomMode(language: ILanguage): Promise; - - export class MonacoWebWorker { - dispose(): void; - getProxy(): Promise; - withSyncedResources(resources: Uri[]): Promise; - } - - export interface IWebWorkerOptions { - moduleId: string; - } - - export function createWebWorker(opts: IWebWorkerOptions): MonacoWebWorker; - - export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise; - - export function colorize(text: string, modeId: string, options: IColorizerOptions): Promise; - - export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string; - - export interface IEditorConstructionOptions extends ICodeEditorWidgetCreationOptions { - value?: string; - mode?: string; - } - - export interface IDiffEditorConstructionOptions extends IDiffEditorOptions { - } - - export interface IEditorOverrideServices { - } - - export interface IMarkerData { - code?: string; - severity: Severity; - message: string; - source?: string; - startLineNumber: number; - startColumn: number; - endLineNumber: number; - endColumn: number; - } - - export interface IColorizerOptions { - tabSize?: number; - } - - export interface IColorizerElementOptions extends IColorizerOptions { - theme?: string; - mimeType?: string; - } -} - - -declare module monaco { - - interface Thenable { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable; - then(onfulfilled?: (value: R) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable; - } - - export interface IDisposable { - dispose(): void; - } - - export interface IEvent { - (listener: (e: T) => any, thisArg?: any): IDisposable; - } - - export class Emitter { - constructor(); - event: IEvent; - fire(event?: T): void; - dispose(): void; - } - - export enum Severity { - Ignore = 0, - Info = 1, - Warning = 2, - Error = 3, - } - - - - // --- Generic promise - export interface TValueCallback { - (value: T): void; - } - - - export interface ProgressCallback { - (progress: any): any; - } - - - export class Promise { - - constructor(init: (complete: TValueCallback, error: (err: any) => void, progress: ProgressCallback) => void, oncancel?: any); - - public then(success?: (value: V) => Promise, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise, error?: (err: any) => U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise, error?: (err: any) => void, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise | U, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise | U, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise | U, error?: (err: any) => U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => Promise | U, error?: (err: any) => void, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => U, error?: (err: any) => Promise, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => U, error?: (err: any) => Promise | U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => U, error?: (err: any) => U, progress?: ProgressCallback): Promise; - public then(success?: (value: V) => U, error?: (err: any) => void, progress?: ProgressCallback): Promise; - - public done(success?: (value: V) => void, error?: (err: any) => any, progress?: ProgressCallback): void; - public cancel(): void; - - public static as(value: ValueType): Promise; - public static is(value: any): value is Promise; - public static timeout(delay: number): Promise; - public static join(promises: Promise[]): Promise; - public static join(promises: Thenable[]): Thenable; - public static join(promises: { [n: string]: Promise }): Promise<{ [n: string]: ValueType }>; - public static any(promises: Promise[]): Promise<{ key: string; value: Promise; }>; - public static wrapError(error: any): Promise; - } - - export class CancellationTokenSource { - token: CancellationToken; - cancel(): void; - dispose(): void; - } - - export interface CancellationToken { - isCancellationRequested: boolean; - onCancellationRequested: IEvent; - } - /** - * Uniform Resource Identifier (Uri) http://tools.ietf.org/html/rfc3986. - * This class is a simple parser which creates the basic component paths - * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation - * and encoding. - * - * foo://example.com:8042/over/there?name=ferret#nose - * \_/ \______________/\_________/ \_________/ \__/ - * | | | | | - * scheme authority path query fragment - * | _____________________|__ - * / \ / \ - * urn:example:animal:ferret:nose - * - * - */ - export class Uri { - constructor(); - /** - * scheme is the 'http' part of 'http://www.msft.com/some/path?query#fragment'. - * The part before the first colon. - */ - scheme: string; - /** - * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'. - * The part between the first double slashes and the next slash. + * authority is the 'www.msft.com' part of 'http://www.msft.com/some/path?query#fragment'. + * The part between the first double slashes and the next slash. */ authority: string; /** @@ -1118,8 +645,83 @@ declare module monaco { } } - declare module monaco.editor { + + + export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services: IEditorOverrideServices): ICodeEditor; + + export function createDiffEditor(domElement: HTMLElement, options: IDiffEditorConstructionOptions, services: IEditorOverrideServices): IDiffEditor; + + export function createModel(value: string, mode: string | ILanguage | languages.IMode, associatedResource?: Uri | string): IModel; + + export function getModels(): IModel[]; + + export function getModel(uri: Uri): IModel; + + export function onDidCreateModel(listener: (model: IModel) => void): IDisposable; + + export function onWillDisposeModel(listener: (model: IModel) => void): IDisposable; + + export function onDidChangeModelMode(listener: (e: { + model: IModel; + oldModeId: string; + }) => void): IDisposable; + + export function setMarkers(model: IModel, owner: string, markers: IMarkerData[]): void; + + export function getOrCreateMode(modeId: string): Promise; + + export function createCustomMode(language: ILanguage): Promise; + + export class MonacoWebWorker { + dispose(): void; + getProxy(): Promise; + withSyncedResources(resources: Uri[]): Promise; + } + + export interface IWebWorkerOptions { + moduleId: string; + } + + export function createWebWorker(opts: IWebWorkerOptions): MonacoWebWorker; + + export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): Promise; + + export function colorize(text: string, modeId: string, options: IColorizerOptions): Promise; + + export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string; + + export interface IEditorConstructionOptions extends ICodeEditorWidgetCreationOptions { + value?: string; + mode?: string; + } + + export interface IDiffEditorConstructionOptions extends IDiffEditorOptions { + } + + export interface IEditorOverrideServices { + } + + export interface IMarkerData { + code?: string; + severity: Severity; + message: string; + source?: string; + startLineNumber: number; + startColumn: number; + endLineNumber: number; + endColumn: number; + } + + export interface IColorizerOptions { + tabSize?: number; + } + + export interface IColorizerElementOptions extends IColorizerOptions { + theme?: string; + mimeType?: string; + } + /** * A Monarch language definition */ @@ -3073,748 +2675,1140 @@ declare module monaco.editor { */ export interface IActionDescriptor { /** - * An unique identifier of the contributed action. + * An unique identifier of the contributed action. + */ + id: string; + /** + * A label of the action that will be presented to the user. + */ + label: string; + /** + * An array of keybindings for the action. + */ + keybindings?: number[]; + keybindingContext?: string; + /** + * A set of enablement conditions. + */ + enablement?: IActionEnablement; + /** + * Control if the action should show up in the context menu and where. + * Built-in groups: + * 1_goto/* => e.g. 1_goto/1_peekDefinition + * 2_change/* => e.g. 2_change/2_format + * 3_edit/* => e.g. 3_edit/1_copy + * 4_tools/* => e.g. 4_tools/1_commands + * You can also create your own group. + * Defaults to null (don't show in context menu). + */ + contextMenuGroupId?: string; + /** + * Method that will be executed when the action is triggered. + * @param editor The editor instance is passed in as a convinience + */ + run: (editor: ICommonCodeEditor) => Promise; + } + + /** + * An editor. + */ + export interface IEditor { + onDidChangeModelRawContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; + onDidChangeModelContent(listener: (e: IModelContentChangedEvent2) => void): IDisposable; + onDidChangeModelMode(listener: (e: IModelModeChangedEvent) => void): IDisposable; + onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; + onDidChangeConfiguration(listener: (e: IConfigurationChangedEvent) => void): IDisposable; + onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; + onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; + onDidDispose(listener: () => void): IDisposable; + dispose(): void; + getId(): string; + /** + * Get the editor type. Current supported types: + * EditorCommon.EditorType.ICodeEditor => ICodeEditor; + * EditorCommon.EditorType.IDiffEditor => IDiffEditor; + * This is to avoid an instanceof check + */ + getEditorType(): string; + /** + * Update the editor's options after the editor has been created. + */ + updateOptions(newOptions: IEditorOptions): void; + /** + * Instructs the editor to remeasure its container. This method should + * be called when the container of the editor gets resized. + */ + layout(dimension?: IDimension): void; + /** + * Brings browser focus to the editor text + */ + focus(): void; + /** + * Returns true if this editor has keyboard focus (e.g. cursor is blinking). + */ + isFocused(): boolean; + /** + * Add a new action to this editor. + */ + addAction(descriptor: IActionDescriptor): void; + /** + * Returns all actions associated with this editor. + */ + getActions(): IAction[]; + /** + * Saves current view state of the editor in a serializable object. + */ + saveViewState(): IEditorViewState; + /** + * Restores the view state of the editor from a serializable object generated by `saveViewState`. + */ + restoreViewState(state: IEditorViewState): void; + /** + * Given a position, returns a column number that takes tab-widths into account. + */ + getVisibleColumnFromPosition(position: IPosition): number; + /** + * Returns the primary position of the cursor. + */ + getPosition(): Position; + /** + * Set the primary position of the cursor. This will remove any secondary cursors. + * @param position New primary cursor's position + */ + setPosition(position: IPosition): void; + /** + * Scroll vertically as necessary and reveal a line. + */ + revealLine(lineNumber: number): void; + /** + * Scroll vertically as necessary and reveal a line centered vertically. + */ + revealLineInCenter(lineNumber: number): void; + /** + * Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport. + */ + revealLineInCenterIfOutsideViewport(lineNumber: number): void; + /** + * Scroll vertically or horizontally as necessary and reveal a position. + */ + revealPosition(position: IPosition): void; + /** + * Scroll vertically or horizontally as necessary and reveal a position centered vertically. + */ + revealPositionInCenter(position: IPosition): void; + /** + * Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport. + */ + revealPositionInCenterIfOutsideViewport(position: IPosition): void; + /** + * Returns the primary selection of the editor. + */ + getSelection(): Selection; + /** + * Returns all the selections of the editor. + */ + getSelections(): Selection[]; + /** + * Set the primary selection of the editor. This will remove any secondary cursors. + * @param selection The new selection + */ + setSelection(selection: IRange): void; + setSelection(selection: Range): void; + setSelection(selection: ISelection): void; + setSelection(selection: Selection): void; + /** + * Set the selections for all the cursors of the editor. + * Cursors will be removed or added, as necessary. + */ + setSelections(selections: ISelection[]): void; + /** + * Scroll vertically as necessary and reveal lines. + */ + revealLines(startLineNumber: number, endLineNumber: number): void; + /** + * Scroll vertically as necessary and reveal lines centered vertically. + */ + revealLinesInCenter(lineNumber: number, endLineNumber: number): void; + /** + * Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport. + */ + revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number): void; + /** + * Scroll vertically or horizontally as necessary and reveal a range. + */ + revealRange(range: IRange): void; + /** + * Scroll vertically or horizontally as necessary and reveal a range centered vertically. + */ + revealRangeInCenter(range: IRange): void; + /** + * Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport. + */ + revealRangeInCenterIfOutsideViewport(range: IRange): void; + /** + * Directly trigger a handler or an editor action. + * @param source The source of the call. + * @param handlerId The id of the handler or the id of a contribution. + * @param payload Extra data to be sent to the handler. + */ + trigger(source: string, handlerId: string, payload: any): void; + /** + * Gets the current model attached to this editor. + */ + getModel(): IEditorModel; + /** + * Sets the current model attached to this editor. + * If the previous model was created by the editor via the value key in the options + * literal object, it will be destroyed. Otherwise, if the previous model was set + * via setModel, or the model key in the options literal object, the previous model + * will not be destroyed. + * It is safe to call setModel(null) to simply detach the current model from the editor. + */ + setModel(model: IEditorModel): void; + } + + /** + * An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed. + */ + export interface IEditorContribution { + /** + * Get a unique identifier for this contribution. + */ + getId(): string; + /** + * Dispose this contribution. + */ + dispose(): void; + /** + * Store view state. + */ + saveViewState?(): any; + /** + * Restore view state. + */ + restoreViewState?(state: any): void; + } + + export interface ICommonCodeEditor extends IEditor { + onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable; + onDidChangeModelModeSupport(listener: (e: IModeSupportChangedEvent) => void): IDisposable; + onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; + onDidFocusEditorText(listener: () => void): IDisposable; + onDidBlurEditorText(listener: () => void): IDisposable; + onDidFocusEditor(listener: () => void): IDisposable; + onDidBlurEditor(listener: () => void): IDisposable; + /** + * Returns true if this editor or one of its widgets has keyboard focus. + */ + hasWidgetFocus(): boolean; + /** + * Get a contribution of this editor. + * @id Unique identifier of the contribution. + * @return The contribution or null if contribution not found. + */ + getContribution(id: string): IEditorContribution; + /** + * Type the getModel() of IEditor. + */ + getModel(): IModel; + /** + * Returns the current editor's configuration + */ + getConfiguration(): InternalEditorOptions; + /** + * Get value of the current model attached to this editor. + * @see IModel.getValue + */ + getValue(options?: { + preserveBOM: boolean; + lineEnding: string; + }): string; + /** + * Set the value of the current model attached to this editor. + * @see IModel.setValue + */ + setValue(newValue: string): void; + /** + * Get the scrollWidth of the editor's viewport. + */ + getScrollWidth(): number; + /** + * Get the scrollLeft of the editor's viewport. */ - id: string; + getScrollLeft(): number; /** - * A label of the action that will be presented to the user. + * Get the scrollHeight of the editor's viewport. */ - label: string; + getScrollHeight(): number; /** - * An array of keybindings for the action. + * Get the scrollTop of the editor's viewport. */ - keybindings?: number[]; - keybindingContext?: string; + getScrollTop(): number; /** - * A set of enablement conditions. + * Change the scrollLeft of the editor's viewport. */ - enablement?: IActionEnablement; + setScrollLeft(newScrollLeft: number): void; /** - * Control if the action should show up in the context menu and where. - * Built-in groups: - * 1_goto/* => e.g. 1_goto/1_peekDefinition - * 2_change/* => e.g. 2_change/2_format - * 3_edit/* => e.g. 3_edit/1_copy - * 4_tools/* => e.g. 4_tools/1_commands - * You can also create your own group. - * Defaults to null (don't show in context menu). + * Change the scrollTop of the editor's viewport. */ - contextMenuGroupId?: string; + setScrollTop(newScrollTop: number): void; /** - * Method that will be executed when the action is triggered. - * @param editor The editor instance is passed in as a convinience + * Change the scroll position of the editor's viewport. */ - run: (editor: ICommonCodeEditor) => Promise; - } - - /** - * An editor. - */ - export interface IEditor { - onDidChangeModelRawContent(listener: (e: IModelContentChangedEvent) => void): IDisposable; - onDidChangeModelContent(listener: (e: IModelContentChangedEvent2) => void): IDisposable; - onDidChangeModelMode(listener: (e: IModelModeChangedEvent) => void): IDisposable; - onDidChangeModelOptions(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; - onDidChangeConfiguration(listener: (e: IConfigurationChangedEvent) => void): IDisposable; - onDidChangeCursorPosition(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; - onDidChangeCursorSelection(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; - onDidDispose(listener: () => void): IDisposable; - dispose(): void; - getId(): string; + setScrollPosition(position: INewScrollPosition): void; /** - * Get the editor type. Current supported types: - * EditorCommon.EditorType.ICodeEditor => ICodeEditor; - * EditorCommon.EditorType.IDiffEditor => IDiffEditor; - * This is to avoid an instanceof check + * Get an action that is a contribution to this editor. + * @id Unique identifier of the contribution. + * @return The action or null if action not found. */ - getEditorType(): string; + getAction(id: string): IAction; /** - * Update the editor's options after the editor has been created. + * Execute a command on the editor. + * @param source The source of the call. + * @param command The command to execute */ - updateOptions(newOptions: IEditorOptions): void; + executeCommand(source: string, command: ICommand): void; /** - * Instructs the editor to remeasure its container. This method should - * be called when the container of the editor gets resized. + * Execute a command on the editor. + * @param source The source of the call. + * @param command The command to execute */ - layout(dimension?: IDimension): void; + executeEdits(source: string, edits: IIdentifiedSingleEditOperation[]): boolean; /** - * Brings browser focus to the editor text + * Execute multiple (concommitent) commands on the editor. + * @param source The source of the call. + * @param command The commands to execute */ - focus(): void; + executeCommands(source: string, commands: ICommand[]): void; /** - * Returns true if this editor has keyboard focus (e.g. cursor is blinking). + * Get all the decorations on a line (filtering out decorations from other editors). */ - isFocused(): boolean; + getLineDecorations(lineNumber: number): IModelDecoration[]; /** - * Add a new action to this editor. + * All decorations added through this call will get the ownerId of this editor. + * @see IModel.deltaDecorations */ - addAction(descriptor: IActionDescriptor): void; + deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; /** - * Returns all actions associated with this editor. + * Get the layout info for the editor. */ - getActions(): IAction[]; + getLayoutInfo(): EditorLayoutInfo; + } + + export interface ICommonDiffEditor extends IEditor { + onDidUpdateDiff(listener: () => void): IDisposable; /** - * Saves current view state of the editor in a serializable object. + * Type the getModel() of IEditor. */ - saveViewState(): IEditorViewState; + getModel(): IDiffEditorModel; + getOriginalEditor(): ICommonCodeEditor; + getModifiedEditor(): ICommonCodeEditor; + getLineChanges(): ILineChange[]; /** - * Restores the view state of the editor from a serializable object generated by `saveViewState`. + * @see ICodeEditor.getValue */ - restoreViewState(state: IEditorViewState): void; + getValue(options?: { + preserveBOM: boolean; + lineEnding: string; + }): string; + } + + export var EditorType: { + ICodeEditor: string; + IDiffEditor: string; + }; + + export var Handler: { + ExecuteCommand: string; + ExecuteCommands: string; + CursorLeft: string; + CursorLeftSelect: string; + CursorWordLeft: string; + CursorWordStartLeft: string; + CursorWordEndLeft: string; + CursorWordLeftSelect: string; + CursorWordStartLeftSelect: string; + CursorWordEndLeftSelect: string; + CursorRight: string; + CursorRightSelect: string; + CursorWordRight: string; + CursorWordStartRight: string; + CursorWordEndRight: string; + CursorWordRightSelect: string; + CursorWordStartRightSelect: string; + CursorWordEndRightSelect: string; + CursorUp: string; + CursorUpSelect: string; + CursorDown: string; + CursorDownSelect: string; + CursorPageUp: string; + CursorPageUpSelect: string; + CursorPageDown: string; + CursorPageDownSelect: string; + CursorHome: string; + CursorHomeSelect: string; + CursorEnd: string; + CursorEndSelect: string; + ExpandLineSelection: string; + CursorTop: string; + CursorTopSelect: string; + CursorBottom: string; + CursorBottomSelect: string; + CursorColumnSelectLeft: string; + CursorColumnSelectRight: string; + CursorColumnSelectUp: string; + CursorColumnSelectPageUp: string; + CursorColumnSelectDown: string; + CursorColumnSelectPageDown: string; + AddCursorDown: string; + AddCursorUp: string; + CursorUndo: string; + MoveTo: string; + MoveToSelect: string; + ColumnSelect: string; + CreateCursor: string; + LastCursorMoveToSelect: string; + JumpToBracket: string; + Type: string; + ReplacePreviousChar: string; + Paste: string; + Tab: string; + Indent: string; + Outdent: string; + DeleteLeft: string; + DeleteRight: string; + DeleteWordLeft: string; + DeleteWordStartLeft: string; + DeleteWordEndLeft: string; + DeleteWordRight: string; + DeleteWordStartRight: string; + DeleteWordEndRight: string; + DeleteAllLeft: string; + DeleteAllRight: string; + RemoveSecondaryCursors: string; + CancelSelection: string; + Cut: string; + Undo: string; + Redo: string; + WordSelect: string; + WordSelectDrag: string; + LastCursorWordSelect: string; + LineSelect: string; + LineSelectDrag: string; + LastCursorLineSelect: string; + LastCursorLineSelectDrag: string; + LineInsertBefore: string; + LineInsertAfter: string; + LineBreakInsert: string; + SelectAll: string; + ScrollLineUp: string; + ScrollLineDown: string; + ScrollPageUp: string; + ScrollPageDown: string; + }; + + export enum TextEditorCursorStyle { + Line = 1, + Block = 2, + Underline = 3, + } + + /** + * A view zone is a full horizontal rectangle that 'pushes' text down. + * The editor reserves space for view zones when rendering. + */ + export interface IViewZone { /** - * Given a position, returns a column number that takes tab-widths into account. + * The line number after which this zone should appear. + * Use 0 to place a view zone before the first line number. */ - getVisibleColumnFromPosition(position: IPosition): number; + afterLineNumber: number; /** - * Returns the primary position of the cursor. + * The column after which this zone should appear. + * If not set, the maxLineColumn of `afterLineNumber` will be used. */ - getPosition(): Position; + afterColumn?: number; /** - * Set the primary position of the cursor. This will remove any secondary cursors. - * @param position New primary cursor's position + * Suppress mouse down events. + * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it. + * Defaults to false */ - setPosition(position: IPosition): void; + suppressMouseDown?: boolean; /** - * Scroll vertically as necessary and reveal a line. + * The height in lines of the view zone. + * If specified, `heightInPx` will be used instead of this. + * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. */ - revealLine(lineNumber: number): void; + heightInLines?: number; /** - * Scroll vertically as necessary and reveal a line centered vertically. + * The height in px of the view zone. + * If this is set, the editor will give preference to it rather than `heightInLines` above. + * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. */ - revealLineInCenter(lineNumber: number): void; + heightInPx?: number; /** - * Scroll vertically as necessary and reveal a line centered vertically only if it lies outside the viewport. + * The dom node of the view zone */ - revealLineInCenterIfOutsideViewport(lineNumber: number): void; + domNode: HTMLElement; /** - * Scroll vertically or horizontally as necessary and reveal a position. + * Callback which gives the relative top of the view zone as it appears (taking scrolling into account). + */ + onDomNodeTop?: (top: number) => void; + /** + * Callback which gives the height in pixels of the view zone. */ - revealPosition(position: IPosition): void; + onComputedHeight?: (height: number) => void; + } + + /** + * An accessor that allows for zones to be added or removed. + */ + export interface IViewZoneChangeAccessor { /** - * Scroll vertically or horizontally as necessary and reveal a position centered vertically. + * Create a new view zone. + * @param zone Zone to create + * @return A unique identifier to the view zone. */ - revealPositionInCenter(position: IPosition): void; + addZone(zone: IViewZone): number; /** - * Scroll vertically or horizontally as necessary and reveal a position centered vertically only if it lies outside the viewport. + * Remove a zone + * @param id A unique identifier to the view zone, as returned by the `addZone` call. */ - revealPositionInCenterIfOutsideViewport(position: IPosition): void; + removeZone(id: number): void; /** - * Returns the primary selection of the editor. + * Change a zone's position. + * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone. */ - getSelection(): Selection; + layoutZone(id: number): void; + } + + /** + * A positioning preference for rendering content widgets. + */ + export enum ContentWidgetPositionPreference { /** - * Returns all the selections of the editor. + * Place the content widget exactly at a position */ - getSelections(): Selection[]; + EXACT = 0, /** - * Set the primary selection of the editor. This will remove any secondary cursors. - * @param selection The new selection + * Place the content widget above a position */ - setSelection(selection: IRange): void; - setSelection(selection: Range): void; - setSelection(selection: ISelection): void; - setSelection(selection: Selection): void; + ABOVE = 1, /** - * Set the selections for all the cursors of the editor. - * Cursors will be removed or added, as necessary. + * Place the content widget below a position */ - setSelections(selections: ISelection[]): void; + BELOW = 2, + } + + /** + * A position for rendering content widgets. + */ + export interface IContentWidgetPosition { /** - * Scroll vertically as necessary and reveal lines. + * Desired position for the content widget. + * `preference` will also affect the placement. */ - revealLines(startLineNumber: number, endLineNumber: number): void; + position: IPosition; /** - * Scroll vertically as necessary and reveal lines centered vertically. + * Placement preference for position, in order of preference. */ - revealLinesInCenter(lineNumber: number, endLineNumber: number): void; + preference: ContentWidgetPositionPreference[]; + } + + /** + * A content widget renders inline with the text and can be easily placed 'near' an editor position. + */ + export interface IContentWidget { /** - * Scroll vertically as necessary and reveal lines centered vertically only if it lies outside the viewport. + * Render this content widget in a location where it could overflow the editor's view dom node. */ - revealLinesInCenterIfOutsideViewport(lineNumber: number, endLineNumber: number): void; + allowEditorOverflow?: boolean; /** - * Scroll vertically or horizontally as necessary and reveal a range. + * Get a unique identifier of the content widget. */ - revealRange(range: IRange): void; + getId(): string; /** - * Scroll vertically or horizontally as necessary and reveal a range centered vertically. + * Get the dom node of the content widget. */ - revealRangeInCenter(range: IRange): void; + getDomNode(): HTMLElement; /** - * Scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport. + * Get the placement of the content widget. + * If null is returned, the content widget will be placed off screen. */ - revealRangeInCenterIfOutsideViewport(range: IRange): void; + getPosition(): IContentWidgetPosition; + } + + /** + * A positioning preference for rendering overlay widgets. + */ + export enum OverlayWidgetPositionPreference { /** - * Directly trigger a handler or an editor action. - * @param source The source of the call. - * @param handlerId The id of the handler or the id of a contribution. - * @param payload Extra data to be sent to the handler. + * Position the overlay widget in the top right corner */ - trigger(source: string, handlerId: string, payload: any): void; + TOP_RIGHT_CORNER = 0, /** - * Gets the current model attached to this editor. + * Position the overlay widget in the bottom right corner */ - getModel(): IEditorModel; + BOTTOM_RIGHT_CORNER = 1, /** - * Sets the current model attached to this editor. - * If the previous model was created by the editor via the value key in the options - * literal object, it will be destroyed. Otherwise, if the previous model was set - * via setModel, or the model key in the options literal object, the previous model - * will not be destroyed. - * It is safe to call setModel(null) to simply detach the current model from the editor. + * Position the overlay widget in the top center */ - setModel(model: IEditorModel): void; + TOP_CENTER = 2, } /** - * An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed. + * A position for rendering overlay widgets. */ - export interface IEditorContribution { + export interface IOverlayWidgetPosition { /** - * Get a unique identifier for this contribution. + * The position preference for the overlay widget. */ - getId(): string; + preference: OverlayWidgetPositionPreference; + } + + /** + * An overlay widgets renders on top of the text. + */ + export interface IOverlayWidget { /** - * Dispose this contribution. + * Get a unique identifier of the overlay widget. */ - dispose(): void; + getId(): string; /** - * Store view state. + * Get the dom node of the overlay widget. */ - saveViewState?(): any; + getDomNode(): HTMLElement; /** - * Restore view state. + * Get the placement of the overlay widget. + * If null is returned, the overlay widget is responsible to place itself. */ - restoreViewState?(state: any): void; + getPosition(): IOverlayWidgetPosition; } - export interface ICommonCodeEditor extends IEditor { - onDidChangeModel(listener: (e: IModelChangedEvent) => void): IDisposable; - onDidChangeModelModeSupport(listener: (e: IModeSupportChangedEvent) => void): IDisposable; - onDidChangeModelDecorations(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; - onDidFocusEditorText(listener: () => void): IDisposable; - onDidBlurEditorText(listener: () => void): IDisposable; - onDidFocusEditor(listener: () => void): IDisposable; - onDidBlurEditor(listener: () => void): IDisposable; + /** + * Target hit with the mouse in the editor. + */ + export interface IMouseTarget { /** - * Returns true if this editor or one of its widgets has keyboard focus. + * The target element */ - hasWidgetFocus(): boolean; + element: Element; /** - * Get a contribution of this editor. - * @id Unique identifier of the contribution. - * @return The contribution or null if contribution not found. + * The target type */ - getContribution(id: string): IEditorContribution; + type: MouseTargetType; /** - * Type the getModel() of IEditor. + * The 'approximate' editor position */ - getModel(): IModel; + position: Position; /** - * Returns the current editor's configuration + * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line). */ - getConfiguration(): InternalEditorOptions; + mouseColumn: number; /** - * Get value of the current model attached to this editor. - * @see IModel.getValue + * The 'approximate' editor range */ - getValue(options?: { - preserveBOM: boolean; - lineEnding: string; - }): string; + range: Range; /** - * Set the value of the current model attached to this editor. - * @see IModel.setValue + * Some extra detail. */ - setValue(newValue: string): void; + detail: any; + } + + /** + * A mouse event originating from the editor. + */ + export interface IEditorMouseEvent { + event: IMouseEvent; + target: IMouseTarget; + } + + /** + * A rich code editor. + */ + export interface ICodeEditor extends ICommonCodeEditor { + onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable; + onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable; + onMouseLeave(listener: (e: IEditorMouseEvent) => void): IDisposable; + onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable; + onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable; + onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; + onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable; /** - * Get the scrollWidth of the editor's viewport. + * Returns the editor's dom node */ - getScrollWidth(): number; + getDomNode(): HTMLElement; /** - * Get the scrollLeft of the editor's viewport. + * Add a content widget. Widgets must have unique ids, otherwise they will be overwritten. */ - getScrollLeft(): number; + addContentWidget(widget: IContentWidget): void; /** - * Get the scrollHeight of the editor's viewport. + * Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() + * and update appropiately. */ - getScrollHeight(): number; + layoutContentWidget(widget: IContentWidget): void; /** - * Get the scrollTop of the editor's viewport. + * Remove a content widget. */ - getScrollTop(): number; + removeContentWidget(widget: IContentWidget): void; /** - * Change the scrollLeft of the editor's viewport. + * Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten. */ - setScrollLeft(newScrollLeft: number): void; + addOverlayWidget(widget: IOverlayWidget): void; /** - * Change the scrollTop of the editor's viewport. + * Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() + * and update appropiately. */ - setScrollTop(newScrollTop: number): void; + layoutOverlayWidget(widget: IOverlayWidget): void; /** - * Change the scroll position of the editor's viewport. + * Remove an overlay widget. */ - setScrollPosition(position: INewScrollPosition): void; + removeOverlayWidget(widget: IOverlayWidget): void; /** - * Get an action that is a contribution to this editor. - * @id Unique identifier of the contribution. - * @return The action or null if action not found. + * Change the view zones. View zones are lost when a new model is attached to the editor. */ - getAction(id: string): IAction; + changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void; /** - * Execute a command on the editor. - * @param source The source of the call. - * @param command The command to execute + * Returns the range that is currently centered in the view port. */ - executeCommand(source: string, command: ICommand): void; + getCenteredRangeInViewport(): Range; /** - * Execute a command on the editor. - * @param source The source of the call. - * @param command The command to execute + * Get the horizontal position (left offset) for the column w.r.t to the beginning of the line. + * This method works only if the line `lineNumber` is currently rendered (in the editor's viewport). + * Use this method with caution. + */ + getOffsetForColumn(lineNumber: number, column: number): number; + /** + * Force an editor render now. */ - executeEdits(source: string, edits: IIdentifiedSingleEditOperation[]): boolean; + render(): void; /** - * Execute multiple (concommitent) commands on the editor. - * @param source The source of the call. - * @param command The commands to execute + * Get the vertical position (top offset) for the line w.r.t. to the first line. */ - executeCommands(source: string, commands: ICommand[]): void; + getTopForLineNumber(lineNumber: number): number; /** - * Get all the decorations on a line (filtering out decorations from other editors). + * Get the vertical position (top offset) for the position w.r.t. to the first line. */ - getLineDecorations(lineNumber: number): IModelDecoration[]; + getTopForPosition(lineNumber: number, column: number): number; /** - * All decorations added through this call will get the ownerId of this editor. - * @see IModel.deltaDecorations + * Get the visible position for `position`. + * The result position takes scrolling into account and is relative to the top left corner of the editor. + * Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor. + * Explanation 2: the results of this method will not change if the container of the editor gets repositioned. + * Warning: the results of this method are innacurate for positions that are outside the current editor viewport. */ - deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; + getScrolledVisiblePosition(position: IPosition): { + top: number; + left: number; + height: number; + }; /** - * Get the layout info for the editor. + * Apply the same font settings as the editor to `target`. */ - getLayoutInfo(): EditorLayoutInfo; + applyFontInfo(target: HTMLElement): void; } - export interface ICommonDiffEditor extends IEditor { - onDidUpdateDiff(listener: () => void): IDisposable; - /** - * Type the getModel() of IEditor. - */ - getModel(): IDiffEditorModel; - getOriginalEditor(): ICommonCodeEditor; - getModifiedEditor(): ICommonCodeEditor; - getLineChanges(): ILineChange[]; + /** + * A rich diff editor. + */ + export interface IDiffEditor extends ICommonDiffEditor { /** - * @see ICodeEditor.getValue + * @see ICodeEditor.getDomNode */ - getValue(options?: { - preserveBOM: boolean; - lineEnding: string; - }): string; + getDomNode(): HTMLElement; } +} - export var EditorType: { - ICodeEditor: string; - IDiffEditor: string; - }; +declare module monaco.languages { - export var Handler: { - ExecuteCommand: string; - ExecuteCommands: string; - CursorLeft: string; - CursorLeftSelect: string; - CursorWordLeft: string; - CursorWordStartLeft: string; - CursorWordEndLeft: string; - CursorWordLeftSelect: string; - CursorWordStartLeftSelect: string; - CursorWordEndLeftSelect: string; - CursorRight: string; - CursorRightSelect: string; - CursorWordRight: string; - CursorWordStartRight: string; - CursorWordEndRight: string; - CursorWordRightSelect: string; - CursorWordStartRightSelect: string; - CursorWordEndRightSelect: string; - CursorUp: string; - CursorUpSelect: string; - CursorDown: string; - CursorDownSelect: string; - CursorPageUp: string; - CursorPageUpSelect: string; - CursorPageDown: string; - CursorPageDownSelect: string; - CursorHome: string; - CursorHomeSelect: string; - CursorEnd: string; - CursorEndSelect: string; - ExpandLineSelection: string; - CursorTop: string; - CursorTopSelect: string; - CursorBottom: string; - CursorBottomSelect: string; - CursorColumnSelectLeft: string; - CursorColumnSelectRight: string; - CursorColumnSelectUp: string; - CursorColumnSelectPageUp: string; - CursorColumnSelectDown: string; - CursorColumnSelectPageDown: string; - AddCursorDown: string; - AddCursorUp: string; - CursorUndo: string; - MoveTo: string; - MoveToSelect: string; - ColumnSelect: string; - CreateCursor: string; - LastCursorMoveToSelect: string; - JumpToBracket: string; - Type: string; - ReplacePreviousChar: string; - Paste: string; - Tab: string; - Indent: string; - Outdent: string; - DeleteLeft: string; - DeleteRight: string; - DeleteWordLeft: string; - DeleteWordStartLeft: string; - DeleteWordEndLeft: string; - DeleteWordRight: string; - DeleteWordStartRight: string; - DeleteWordEndRight: string; - DeleteAllLeft: string; - DeleteAllRight: string; - RemoveSecondaryCursors: string; - CancelSelection: string; - Cut: string; - Undo: string; - Redo: string; - WordSelect: string; - WordSelectDrag: string; - LastCursorWordSelect: string; - LineSelect: string; - LineSelectDrag: string; - LastCursorLineSelect: string; - LastCursorLineSelectDrag: string; - LineInsertBefore: string; - LineInsertAfter: string; - LineBreakInsert: string; - SelectAll: string; - ScrollLineUp: string; - ScrollLineDown: string; - ScrollPageUp: string; - ScrollPageDown: string; - }; - export enum TextEditorCursorStyle { - Line = 1, - Block = 2, - Underline = 3, + export function setLanguageConfiguration(languageId: string, configuration: IRichLanguageConfiguration): IDisposable; + + export function setTokensProvider(languageId: string, support: TokensProvider): IDisposable; + + export function registerReferenceProvider(languageId: string, support: ReferenceProvider): IDisposable; + + export function registerRenameProvider(languageId: string, support: RenameProvider): IDisposable; + + export enum CompletionItemKind { + Text = 0, + Method = 1, + Function = 2, + Constructor = 3, + Field = 4, + Variable = 5, + Class = 6, + Interface = 7, + Module = 8, + Property = 9, + Unit = 10, + Value = 11, + Enum = 12, + Keyword = 13, + Snippet = 14, + Color = 15, + File = 16, + Reference = 17, + } + + export interface CompletionItem { + label: string; + kind: CompletionItemKind; + detail?: string; + documentation?: string; + sortText?: string; + filterText?: string; + insertText?: string; + textEdit?: editor.ISingleEditOperation; + } + + export interface CompletionList { + isIncomplete?: boolean; + items: CompletionItem[]; + } + + export interface CompletionItemProvider { + triggerCharacters?: string[]; + provideCompletionItems(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): CompletionItem[] | Thenable | CompletionList | Thenable; + resolveCompletionItem?(item: CompletionItem, token: CancellationToken): CompletionItem | Thenable; + } + + export function registerCompletionItemProvider(languageId: string, provider: CompletionItemProvider): IDisposable; + + export function registerSignatureHelpProvider(languageId: string, support: SignatureHelpProvider): IDisposable; + + export function registerHoverProvider(languageId: string, support: HoverProvider): IDisposable; + + export function registerDocumentSymbolProvider(languageId: string, support: DocumentSymbolProvider): IDisposable; + + export function registerDocumentHighlightProvider(languageId: string, support: DocumentHighlightProvider): IDisposable; + + export function registerDefinitionProvider(languageId: string, support: DefinitionProvider): IDisposable; + + export function registerCodeLensProvider(languageId: string, support: CodeLensProvider): IDisposable; + + export function registerCodeActionProvider(languageId: string, support: CodeActionProvider): IDisposable; + + export function registerDocumentFormattingEditProvider(languageId: string, support: DocumentFormattingEditProvider): IDisposable; + + export function registerDocumentRangeFormattingEditProvider(languageId: string, support: DocumentRangeFormattingEditProvider): IDisposable; + + export function registerOnTypeFormattingEditProvider(languageId: string, support: OnTypeFormattingEditProvider): IDisposable; + + export function registerLinkProvider(languageId: string, support: LinkProvider): IDisposable; + + export function registerMonarchStandaloneLanguage(language: ILanguageExtensionPoint, defModule: string): void; + + export function register(language: ILanguageExtensionPoint): void; + + export function onLanguage(languageId: string, callback: () => void): IDisposable; + + export interface CommentRule { + lineComment?: string; + blockComment?: CharacterPair; + } + + export interface IRichLanguageConfiguration { + comments?: CommentRule; + brackets?: CharacterPair[]; + wordPattern?: RegExp; + indentationRules?: IIndentationRules; + onEnterRules?: IOnEnterRegExpRules[]; + autoClosingPairs?: IAutoClosingPairConditional[]; + surroundingPairs?: IAutoClosingPair[]; + __electricCharacterSupport?: IBracketElectricCharacterContribution; + } + + export interface IIndentationRules { + decreaseIndentPattern: RegExp; + increaseIndentPattern: RegExp; + indentNextLinePattern?: RegExp; + unIndentedLinePattern?: RegExp; + } + + export interface IOnEnterRegExpRules { + beforeText: RegExp; + afterText?: RegExp; + action: IEnterAction; + } + + export interface IBracketElectricCharacterContribution { + docComment?: IDocComment; + caseInsensitive?: boolean; + embeddedElectricCharacters?: string[]; + } + + /** + * Definition of documentation comments (e.g. Javadoc/JSdoc) + */ + export interface IDocComment { + scope: string; + open: string; + lineStart: string; + close?: string; + } + + export interface IMode { + getId(): string; + } + + export interface IToken { + startIndex: number; + scopes: string | string[]; + } + + export interface ILineTokens { + tokens: IToken[]; + endState: IState; + retokenize?: Promise; + } + + export interface IState { + clone(): IState; + equals(other: IState): boolean; + } + + export interface TokensProvider { + getInitialState(): IState; + tokenize(line: string, state: IState): ILineTokens; } /** - * A view zone is a full horizontal rectangle that 'pushes' text down. - * The editor reserves space for view zones when rendering. + * A hover represents additional information for a symbol or word. Hovers are + * rendered in a tooltip-like widget. */ - export interface IViewZone { - /** - * The line number after which this zone should appear. - * Use 0 to place a view zone before the first line number. - */ - afterLineNumber: number; - /** - * The column after which this zone should appear. - * If not set, the maxLineColumn of `afterLineNumber` will be used. - */ - afterColumn?: number; - /** - * Suppress mouse down events. - * If set, the editor will attach a mouse down listener to the view zone and .preventDefault on it. - * Defaults to false - */ - suppressMouseDown?: boolean; - /** - * The height in lines of the view zone. - * If specified, `heightInPx` will be used instead of this. - * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. - */ - heightInLines?: number; - /** - * The height in px of the view zone. - * If this is set, the editor will give preference to it rather than `heightInLines` above. - * If neither `heightInPx` nor `heightInLines` is specified, a default of `heightInLines` = 1 will be chosen. - */ - heightInPx?: number; - /** - * The dom node of the view zone - */ - domNode: HTMLElement; + export interface Hover { /** - * Callback which gives the relative top of the view zone as it appears (taking scrolling into account). + * The contents of this hover. */ - onDomNodeTop?: (top: number) => void; + htmlContent: IHTMLContentElement[]; /** - * Callback which gives the height in pixels of the view zone. + * The range to which this hover applies. When missing, the + * editor will use the range at the current position or the + * current position itself. */ - onComputedHeight?: (height: number) => void; + range: IRange; + } + + export interface HoverProvider { + provideHover(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Hover | Thenable; } /** - * An accessor that allows for zones to be added or removed. + * Interface used to quick fix typing errors while accesing member fields. */ - export interface IViewZoneChangeAccessor { - /** - * Create a new view zone. - * @param zone Zone to create - * @return A unique identifier to the view zone. - */ - addZone(zone: IViewZone): number; - /** - * Remove a zone - * @param id A unique identifier to the view zone, as returned by the `addZone` call. - */ - removeZone(id: number): void; - /** - * Change a zone's position. - * The editor will rescan the `afterLineNumber` and `afterColumn` properties of a view zone. - */ - layoutZone(id: number): void; + export interface IQuickFix { + command: ICommand; + score: number; + } + + export interface CodeActionProvider { + provideCodeActions(model: editor.IReadOnlyModel, range: Range, token: CancellationToken): IQuickFix[] | Thenable; + } + + export interface ParameterInformation { + label: string; + documentation: string; + } + + export interface SignatureInformation { + label: string; + documentation: string; + parameters: ParameterInformation[]; + } + + export interface SignatureHelp { + signatures: SignatureInformation[]; + activeSignature: number; + activeParameter: number; + } + + export interface SignatureHelpProvider { + signatureHelpTriggerCharacters: string[]; + provideSignatureHelp(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): SignatureHelp | Thenable; + } + + export enum DocumentHighlightKind { + Text = 0, + Read = 1, + Write = 2, + } + + export interface DocumentHighlight { + range: IRange; + kind: DocumentHighlightKind; + } + + export interface DocumentHighlightProvider { + provideDocumentHighlights(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): DocumentHighlight[] | Thenable; + } + + export interface ReferenceContext { + includeDeclaration: boolean; + } + + export interface ReferenceProvider { + provideReferences(model: editor.IReadOnlyModel, position: Position, context: ReferenceContext, token: CancellationToken): Location[] | Thenable; + } + + export class Location { + uri: Uri; + range: IRange; + } + + export type Definition = Location | Location[]; + + export interface DefinitionProvider { + provideDefinition(model: editor.IReadOnlyModel, position: Position, token: CancellationToken): Definition | Thenable; + } + + export enum SymbolKind { + File = 0, + Module = 1, + Namespace = 2, + Package = 3, + Class = 4, + Method = 5, + Property = 6, + Field = 7, + Constructor = 8, + Enum = 9, + Interface = 10, + Function = 11, + Variable = 12, + Constant = 13, + String = 14, + Number = 15, + Boolean = 16, + Array = 17, + Object = 18, + Key = 19, + Null = 20, + } + + export interface SymbolInformation { + name: string; + containerName?: string; + kind: SymbolKind; + location: Location; + } + + export interface DocumentSymbolProvider { + provideDocumentSymbols(model: editor.IReadOnlyModel, token: CancellationToken): SymbolInformation[] | Thenable; } /** - * A positioning preference for rendering content widgets. + * Interface used to format a model */ - export enum ContentWidgetPositionPreference { - /** - * Place the content widget exactly at a position - */ - EXACT = 0, - /** - * Place the content widget above a position - */ - ABOVE = 1, - /** - * Place the content widget below a position - */ - BELOW = 2, + export interface IFormattingOptions { + tabSize: number; + insertSpaces: boolean; + } + + export interface DocumentFormattingEditProvider { + provideDocumentFormattingEdits(model: editor.IReadOnlyModel, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; + } + + export interface DocumentRangeFormattingEditProvider { + provideDocumentRangeFormattingEdits(model: editor.IReadOnlyModel, range: Range, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; + } + + export interface OnTypeFormattingEditProvider { + autoFormatTriggerCharacters: string[]; + provideOnTypeFormattingEdits(model: editor.IReadOnlyModel, position: Position, ch: string, options: IFormattingOptions, token: CancellationToken): editor.ISingleEditOperation[] | Thenable; + } + + export interface ILink { + range: IRange; + url: string; + } + + export interface LinkProvider { + provideLinks(model: editor.IReadOnlyModel, token: CancellationToken): ILink[] | Thenable; + } + + export interface IResourceEdit { + resource: Uri; + range: IRange; + newText: string; + } + + export interface WorkspaceEdit { + edits: IResourceEdit[]; + rejectReason?: string; } - /** - * A position for rendering content widgets. - */ - export interface IContentWidgetPosition { - /** - * Desired position for the content widget. - * `preference` will also affect the placement. - */ - position: IPosition; - /** - * Placement preference for position, in order of preference. - */ - preference: ContentWidgetPositionPreference[]; + export interface RenameProvider { + provideRenameEdits(model: editor.IReadOnlyModel, position: Position, newName: string, token: CancellationToken): WorkspaceEdit | Thenable; } - /** - * A content widget renders inline with the text and can be easily placed 'near' an editor position. - */ - export interface IContentWidget { - /** - * Render this content widget in a location where it could overflow the editor's view dom node. - */ - allowEditorOverflow?: boolean; - /** - * Get a unique identifier of the content widget. - */ - getId(): string; - /** - * Get the dom node of the content widget. - */ - getDomNode(): HTMLElement; - /** - * Get the placement of the content widget. - * If null is returned, the content widget will be placed off screen. - */ - getPosition(): IContentWidgetPosition; + export interface ICommand { + id: string; + title: string; + arguments?: any[]; } - /** - * A positioning preference for rendering overlay widgets. - */ - export enum OverlayWidgetPositionPreference { - /** - * Position the overlay widget in the top right corner - */ - TOP_RIGHT_CORNER = 0, - /** - * Position the overlay widget in the bottom right corner - */ - BOTTOM_RIGHT_CORNER = 1, - /** - * Position the overlay widget in the top center - */ - TOP_CENTER = 2, + export interface ICodeLensSymbol { + range: IRange; + id?: string; + command?: ICommand; } - /** - * A position for rendering overlay widgets. - */ - export interface IOverlayWidgetPosition { - /** - * The position preference for the overlay widget. - */ - preference: OverlayWidgetPositionPreference; + export interface CodeLensProvider { + provideCodeLenses(model: editor.IReadOnlyModel, token: CancellationToken): ICodeLensSymbol[] | Thenable; + resolveCodeLens?(model: editor.IReadOnlyModel, codeLens: ICodeLensSymbol, token: CancellationToken): ICodeLensSymbol | Thenable; } - /** - * An overlay widgets renders on top of the text. - */ - export interface IOverlayWidget { - /** - * Get a unique identifier of the overlay widget. - */ - getId(): string; - /** - * Get the dom node of the overlay widget. - */ - getDomNode(): HTMLElement; - /** - * Get the placement of the overlay widget. - * If null is returned, the overlay widget is responsible to place itself. - */ - getPosition(): IOverlayWidgetPosition; + export type CharacterPair = [string, string]; + + export interface IAutoClosingPairConditional extends IAutoClosingPair { + notIn?: string[]; } - /** - * Target hit with the mouse in the editor. - */ - export interface IMouseTarget { - /** - * The target element - */ - element: Element; - /** - * The target type - */ - type: MouseTargetType; - /** - * The 'approximate' editor position - */ - position: Position; - /** - * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line). - */ - mouseColumn: number; - /** - * The 'approximate' editor range - */ - range: Range; - /** - * Some extra detail. - */ - detail: any; + export enum IndentAction { + None = 0, + Indent = 1, + IndentOutdent = 2, + Outdent = 3, } /** - * A mouse event originating from the editor. + * An action the editor executes when 'enter' is being pressed */ - export interface IEditorMouseEvent { - event: IMouseEvent; - target: IMouseTarget; + export interface IEnterAction { + indentAction: IndentAction; + appendText?: string; + removeText?: number; } - /** - * A rich code editor. - */ - export interface ICodeEditor extends ICommonCodeEditor { - onMouseUp(listener: (e: IEditorMouseEvent) => void): IDisposable; - onMouseDown(listener: (e: IEditorMouseEvent) => void): IDisposable; - onContextMenu(listener: (e: IEditorMouseEvent) => void): IDisposable; - onMouseMove(listener: (e: IEditorMouseEvent) => void): IDisposable; - onMouseLeave(listener: (e: IEditorMouseEvent) => void): IDisposable; - onKeyUp(listener: (e: IKeyboardEvent) => void): IDisposable; - onKeyDown(listener: (e: IKeyboardEvent) => void): IDisposable; - onDidLayoutChange(listener: (e: EditorLayoutInfo) => void): IDisposable; - onDidScrollChange(listener: (e: IScrollEvent) => void): IDisposable; - /** - * Returns the editor's dom node - */ - getDomNode(): HTMLElement; - /** - * Add a content widget. Widgets must have unique ids, otherwise they will be overwritten. - */ - addContentWidget(widget: IContentWidget): void; - /** - * Layout/Reposition a content widget. This is a ping to the editor to call widget.getPosition() - * and update appropiately. - */ - layoutContentWidget(widget: IContentWidget): void; - /** - * Remove a content widget. - */ - removeContentWidget(widget: IContentWidget): void; - /** - * Add an overlay widget. Widgets must have unique ids, otherwise they will be overwritten. - */ - addOverlayWidget(widget: IOverlayWidget): void; - /** - * Layout/Reposition an overlay widget. This is a ping to the editor to call widget.getPosition() - * and update appropiately. - */ - layoutOverlayWidget(widget: IOverlayWidget): void; - /** - * Remove an overlay widget. - */ - removeOverlayWidget(widget: IOverlayWidget): void; - /** - * Change the view zones. View zones are lost when a new model is attached to the editor. - */ - changeViewZones(callback: (accessor: IViewZoneChangeAccessor) => void): void; - /** - * Returns the range that is currently centered in the view port. - */ - getCenteredRangeInViewport(): Range; - /** - * Get the horizontal position (left offset) for the column w.r.t to the beginning of the line. - * This method works only if the line `lineNumber` is currently rendered (in the editor's viewport). - * Use this method with caution. - */ - getOffsetForColumn(lineNumber: number, column: number): number; - /** - * Force an editor render now. - */ - render(): void; - /** - * Get the vertical position (top offset) for the line w.r.t. to the first line. - */ - getTopForLineNumber(lineNumber: number): number; - /** - * Get the vertical position (top offset) for the position w.r.t. to the first line. - */ - getTopForPosition(lineNumber: number, column: number): number; - /** - * Get the visible position for `position`. - * The result position takes scrolling into account and is relative to the top left corner of the editor. - * Explanation 1: the results of this method will change for the same `position` if the user scrolls the editor. - * Explanation 2: the results of this method will not change if the container of the editor gets repositioned. - * Warning: the results of this method are innacurate for positions that are outside the current editor viewport. - */ - getScrolledVisiblePosition(position: IPosition): { - top: number; - left: number; - height: number; - }; - /** - * Apply the same font settings as the editor to `target`. - */ - applyFontInfo(target: HTMLElement): void; + export interface IAutoClosingPair { + open: string; + close: string; } - /** - * A rich diff editor. - */ - export interface IDiffEditor extends ICommonDiffEditor { - /** - * @see ICodeEditor.getDomNode - */ - getDomNode(): HTMLElement; + export interface ILanguageExtensionPoint { + id: string; + extensions?: string[]; + filenames?: string[]; + filenamePatterns?: string[]; + firstLine?: string; + aliases?: string[]; + mimetypes?: string[]; + configuration?: string; + } + +} + +declare module monaco.worker { + + export interface IMirrorModel { + uri: Uri; + version: number; + getText(): string; } + + export var mirrorModels: IMirrorModel[]; + } \ No newline at end of file