From d6659f6dd3e8e03b42cbb9dd286cd2fd78c90f84 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Wed, 25 May 2016 13:19:54 +0200 Subject: [PATCH] Reduce standalone editor API through @internal markers --- build/lib/monaco-editor.d.ts | 938 +------------------------ build/lib/monaco-editor.d.ts.recipe | 71 +- build/lib/monaco.js | 77 +- build/lib/monaco.ts | 87 ++- src/vs/editor/browser/editorBrowser.ts | 37 + src/vs/editor/common/editorCommon.ts | 223 +++++- 6 files changed, 436 insertions(+), 997 deletions(-) diff --git a/build/lib/monaco-editor.d.ts b/build/lib/monaco-editor.d.ts index b5e33fe2334..bcaf4dc242d 100644 --- a/build/lib/monaco-editor.d.ts +++ b/build/lib/monaco-editor.d.ts @@ -1,3 +1,5 @@ +// TODO@Alex: Remove EventType, EmitterEvent, ListenerCallback, BulkListenerCallback, IEventEmitter + declare module monaco.editor { export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services?: any): ICodeEditor; @@ -7,7 +9,7 @@ declare module monaco.editor { export function createCustomMode(description: ILanguage): TPromise; export function colorize(text: string, modeId: string, options: IColorizerOptions): TPromise; export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise; - export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string; + // export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string; export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string; export function registerWorkerParticipant(modeId: string, moduleName: string, ctorName: string): void; export function configureMode(modeId: string, options: any): void; @@ -51,17 +53,6 @@ declare module monaco { dispose(): void; } - export interface IEvent { - (listener: (e: T) => any, thisArg?: any): IDisposable; - } - - export class Emitter { - constructor(); - event: IEvent; - fire(event?: T): void; - dispose(): void; - } - // --- Generic promise @@ -185,6 +176,7 @@ declare module monaco { static revive(data: any): Uri; } + // TODO@Alex: START remove this export class EmitterEvent { private _type; @@ -208,6 +200,7 @@ declare module monaco { addBulkListener2(listener: BulkListenerCallback): IDisposable; addEmitter2(eventEmitter: IEventEmitter): IDisposable; } + // TODO@Alex: END remove this /** @@ -440,7 +433,6 @@ declare module monaco { preventDefault(): void; stopPropagation(): void; } - export interface IMouseEvent { browserEvent: MouseEvent; leftButton: boolean; @@ -459,18 +451,15 @@ declare module monaco { stopPropagation(): void; } - export interface IPlatformServices { - } - - export interface IInstantiationService { - } - - export interface IConstructorSignature1 { - new (context: IPlatformServices, first: A1): T; - } - - export interface IConstructorSignature2 { - new (context: IPlatformServices, first: A1, second: A2): T; + export interface IScrollEvent { + scrollTop: number; + scrollLeft: number; + scrollWidth: number; + scrollHeight: number; + scrollTopChanged: boolean; + scrollLeftChanged: boolean; + scrollWidthChanged: boolean; + scrollHeightChanged: boolean; } @@ -784,41 +773,6 @@ declare module monaco.editor { token: string; } - - export class ModeTransition { - _modeTransitionBrand: void; - startIndex: number; - mode: IMode; - constructor(startIndex: number, mode: IMode); - static findIndexInSegmentsArray(arr: ModeTransition[], desiredIndex: number): number; - static create(modeTransitions: IModeTransition[]): ModeTransition[]; - } - - - /** - * Interface used for tokenization - */ - export interface IToken { - startIndex: number; - type: string; - } - - export interface IModeTransition { - startIndex: number; - mode: IMode; - } - - export interface ILineContext { - getLineContent(): string; - modeTransitions: ModeTransition[]; - getTokenCount(): number; - getTokenStartIndex(tokenIndex: number): number; - getTokenType(tokenIndex: number): string; - getTokenText(tokenIndex: number): string; - getTokenEndIndex(tokenIndex: number): number; - findIndexOfOffset(offset: number): number; - } - export interface IMode { } @@ -829,23 +783,6 @@ declare module monaco.editor { Visible = 3, } - /** - * A token on a line. - */ - export class ViewLineToken { - _viewLineTokenBrand: void; - startIndex: number; - type: string; - constructor(startIndex: number, type: string); - equals(other: ViewLineToken): boolean; - static findIndexInSegmentsArray(arr: ViewLineToken[], desiredIndex: number): number; - static equalsArray(a: ViewLineToken[], b: ViewLineToken[]): boolean; - } - - - export interface IEvent { - (listener: (e: T) => any, thisArg?: any): IDisposable; - } /** * Configuration options for editor scrollbars @@ -1497,20 +1434,6 @@ declare module monaco.editor { options: IModelDecorationOptions; } - /** - * A tracked range in the model. - */ - export interface IModelTrackedRange { - /** - * Identifier for a tracked range - */ - id: string; - /** - * Range that this tracked range covers - */ - range: Range; - } - /** * A decoration in the model. */ @@ -1533,46 +1456,6 @@ declare module monaco.editor { options: IModelDecorationOptions; } - /** - * An accessor that can add, change or remove model decorations. - */ - export interface IModelDecorationsChangeAccessor { - /** - * Add a new decoration. - * @param range Range that this decoration covers. - * @param options Options associated with this decoration. - * @return An unique identifier associated with this decoration. - */ - addDecoration(range: IRange, options: IModelDecorationOptions): string; - /** - * Change the range that an existing decoration covers. - * @param id The unique identifier associated with the decoration. - * @param newRange The new range that this decoration covers. - */ - changeDecoration(id: string, newRange: IRange): void; - /** - * Change the options associated with an existing decoration. - * @param id The unique identifier associated with the decoration. - * @param newOptions The new options associated with this decoration. - */ - changeDecorationOptions(id: string, newOptions: IModelDecorationOptions): void; - /** - * Remove an existing decoration. - * @param id The unique identifier associated with the decoration. - */ - removeDecoration(id: string): void; - /** - * Perform a minimum ammount of operations, in order to transform the decorations - * identified by `oldDecorations` to the decorations described by `newDecorations` - * and returns the new identifiers associated with the resulting decorations. - * - * @param oldDecorations Array containing previous decorations identifiers. - * @param newDecorations Array describing what decorations should result after the call. - * @return An array containing the new decorations identifiers. - */ - deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; - } - /** * Word inside a model. */ @@ -1591,34 +1474,6 @@ declare module monaco.editor { endColumn: number; } - /** - * Range of a word inside a model. - */ - export interface IWordRange { - /** - * The index where the word starts. - */ - start: number; - /** - * The index where the word ends. - */ - end: number; - } - - export interface ITokenInfo { - token: IToken; - lineNumber: number; - startColumn: number; - endColumn: number; - } - - export interface ITokenIterator { - hasNext(): boolean; - next(): ITokenInfo; - hasPrev(): boolean; - prev(): ITokenInfo; - } - /** * End of line character preference. */ @@ -1665,14 +1520,6 @@ declare module monaco.editor { CRLF = 1, } - /** - * A read-only line marker in the model. - */ - export interface IReadOnlyLineMarker { - id: string; - column: number; - } - /** * And identifier for a single edit operation. */ @@ -1744,26 +1591,6 @@ declare module monaco.editor { computeCursorState(model: ITokenizedModel, helper: ICursorStateComputerData): Selection; } - /** - * A single edit operation, that acts as a simple replace. - * i.e. Replace text at `range` with `text` in model. - */ - export interface ISingleEditOperation { - /** - * The range to replace. This can be empty to emulate a simple insert. - */ - range: IRange; - /** - * The text to replace with. This can be null to emulate a simple delete. - */ - text: string; - /** - * This indicates that this operation has "insert" semantics. - * i.e. forceMoveMarkers = true => if `range` is collapsed, all markers at the position will be moved. - */ - forceMoveMarkers?: boolean; - } - /** * A single edit operation, that has an identifier. */ @@ -1802,33 +1629,6 @@ declare module monaco.editor { (inverseEditOperations: IIdentifiedSingleEditOperation[]): Selection[]; } - /** - * A list of tokens on a line. - */ - export interface ILineTokens { - getTokenCount(): number; - getTokenStartIndex(tokenIndex: number): number; - getTokenType(tokenIndex: number): string; - getTokenEndIndex(tokenIndex: number, textLength: number): number; - /** - * Check if tokens have changed. This is called by the view to validate rendered lines - * and decide which lines need re-rendering. - */ - equals(other: ILineTokens): boolean; - /** - * Find the token containing offset `offset`. - * For example, with the following tokens [0, 5), [5, 9), [9, infinity) - * Searching for 0, 1, 2, 3 or 4 will return 0. - * Searching for 5, 6, 7 or 8 will return 1. - * Searching for 9, 10, 11, ... will return 2. - * @param offset The search offset - * @return The index of the token containing the offset. - */ - findIndexOfOffset(offset: number): number; - sliceAndInflate(startOffset: number, endOffset: number, deltaStartIndex: number): ViewLineToken[]; - inflate(): ViewLineToken[]; - } - export interface ITextModelResolvedOptions { tabSize: number; insertSpaces: boolean; @@ -1904,13 +1704,6 @@ declare module monaco.editor { * @return The text length. */ getValueLengthInRange(range: IRange): number; - /** - * Splits characters in two buckets. First bucket (A) is of characters that - * sit in lines with length < `LONG_LINE_BOUNDARY`. Second bucket (B) is of - * characters that sit in lines with length >= `LONG_LINE_BOUNDARY`. - * If count(B) > count(A) return true. Returns false otherwise. - */ - isDominatedByLongLines(): boolean; /** * Get the number of lines in the model. */ @@ -1974,16 +1767,6 @@ declare module monaco.editor { * Returns iff the model was disposed or not. */ isDisposed(): boolean; - /** - * No mode supports allowed on this model because it is simply too large. - * (even tokenization would cause too much memory pressure) - */ - isTooLargeForHavingAMode(): boolean; - /** - * Only basic mode supports allowed on this model because it is simply too large. - * (tokenization is allowed and other basic supports) - */ - isTooLargeForHavingARichMode(): boolean; } export interface IReadOnlyModel extends ITextModel { @@ -2008,29 +1791,10 @@ declare module monaco.editor { getWordUntilPosition(position: IPosition): IWordAtPosition; } - export interface IRichEditBracket { - modeId: string; - open: string; - close: string; - forwardRegex: RegExp; - reversedRegex: RegExp; - } - /** * A model that is tokenized. */ export interface ITokenizedModel extends ITextModel { - /** - * Tokenize if necessary and get the tokens for the line `lineNumber`. - * @param lineNumber The line number - * @param inaccurateTokensAcceptable Are inaccurate tokens acceptable? Defaults to false - */ - getLineTokens(lineNumber: number, inaccurateTokensAcceptable?: boolean): ILineTokens; - /** - * Tokenize if necessary and get the tokenization result for the line `lineNumber`, as returned by the language mode. - */ - getLineContext(lineNumber: number): ILineContext; - _getLineModeTransitions(lineNumber: number): IModeTransition[]; /** * Get the current language mode associated with the model. */ @@ -2039,17 +1803,6 @@ declare module monaco.editor { * Set the current language mode associated with the model. */ setMode(newMode: IMode | TPromise): void; - /** - * A mode can be currently pending loading if a promise is used when constructing a model or calling setMode(). - * - * If there is no currently pending loading mode, then the result promise will complete immediately. - * Otherwise, the result will complete once the currently pending loading mode is loaded. - */ - whenModeIsReady(): TPromise; - /** - * Returns the true (inner-most) language mode at a given position. - */ - getModeAtPosition(lineNumber: number, column: number): IMode; /** * Get the word under or besides `position`. * @param position The position to look for a word. @@ -2064,45 +1817,12 @@ declare module monaco.editor { * @return The word under or besides `position`. Will never be null. */ getWordUntilPosition(position: IPosition): IWordAtPosition; - /** - * Returns an iterator that can be used to read - * next and previous tokens from the provided position. - * The iterator is made available through the callback - * function and can't be used afterwards. - */ - tokenIterator(position: IPosition, callback: (it: ITokenIterator) => any): any; - /** - * Find the matching bracket of `request` up, counting brackets. - * @param request The bracket we're searching for - * @param position The position at which to start the search. - * @return The range of the matching bracket, or null if the bracket match was not found. - */ - findMatchingBracketUp(bracket: string, position: IPosition): Range; - /** - * Given a `position`, if the position is on top or near a bracket, - * find the matching bracket of that bracket and return the ranges of both brackets. - * @param position The position at which to look for a bracket. - */ - matchBracket(position: IPosition): [Range, Range]; } /** * A model that can track markers. */ export interface ITextModelWithMarkers extends ITextModel { - _addMarker(lineNumber: number, column: number, stickToPreviousCharacter: boolean): string; - _changeMarker(id: string, newLineNumber: number, newColumn: number): void; - _changeMarkerStickiness(id: string, newStickToPreviousCharacter: boolean): void; - _getMarker(id: string): Position; - _removeMarker(id: string): void; - _getLineMarkers(lineNumber: number): IReadOnlyLineMarker[]; - } - - /** - * A map of changed ranges used during the model internal processing - */ - export interface IChangedTrackedRanges { - [key: string]: IRange; } export enum TrackedRangeStickiness { @@ -2116,56 +1836,12 @@ declare module monaco.editor { * A model that can track ranges. */ export interface ITextModelWithTrackedRanges extends ITextModel { - /** - * Start tracking a range (across edit operations). - * @param range The range to start tracking. - * @param stickiness The behaviour when typing at the edges of the range. - * @return A unique identifier for the tracked range. - */ - addTrackedRange(range: IRange, stickiness: TrackedRangeStickiness): string; - /** - * Change the range of a tracked range. - * @param id The id of the tracked range, as returned by a `addTrackedRange` call. - * @param newRange The new range of the tracked range. - */ - changeTrackedRange(id: string, newRange: IRange): void; - /** - * Change the stickiness (behaviour when typing at the edges of the range) for a tracked range. - * @param id The id of the tracked range, as returned by a `addTrackedRange` call. - * @param newStickiness The new behaviour when typing at the edges of the range. - */ - changeTrackedRangeStickiness(id: string, newStickiness: TrackedRangeStickiness): void; - /** - * Remove a tracked range. - * @param id The id of the tracked range, as returned by a `addTrackedRaneg` call. - */ - removeTrackedRange(id: string): void; - /** - * Get the range of a tracked range. - * @param id The id of the tracked range, as returned by a `addTrackedRaneg` call. - */ - getTrackedRange(id: string): Range; - /** - * Gets all the tracked ranges for the lines between `startLineNumber` and `endLineNumber` as an array. - * @param startLineNumber The start line number - * @param endLineNumber The end line number - * @return An array with the tracked ranges - */ - getLinesTrackedRanges(startLineNumber: number, endLineNumber: number): IModelTrackedRange[]; } /** * A model that can have decorations. */ export interface ITextModelWithDecorations { - /** - * Change the decorations. The callback will be called with a change accessor - * that becomes invalid as soon as the callback finishes executing. - * This allows for all events to be queued up until the change - * is completed. Returns whatever the callback returns. - * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model. - */ - changeDecorations(callback: (changeAccessor: IModelDecorationsChangeAccessor) => any, ownerId?: number): any; /** * Perform a minimum ammount of operations, in order to transform the decorations * identified by `oldDecorations` to the decorations described by `newDecorations` @@ -2177,11 +1853,6 @@ declare module monaco.editor { * @return An array containing the new decorations identifiers. */ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[], ownerId?: number): string[]; - /** - * Remove all decorations that have been added with this specific ownerId. - * @param ownerId The owner id to search for. - */ - removeAllDecorationsWithOwnerId(ownerId: number): void; /** * Get the options associated with a decoration. * @param id The decoration id. @@ -2258,28 +1929,6 @@ declare module monaco.editor { * @return The inverse edit operations, that, when applied, will bring the model back to the previous state. */ applyEdits(operations: IIdentifiedSingleEditOperation[]): IIdentifiedSingleEditOperation[]; - /** - * Undo edit operations until the first previous stop point created by `pushStackElement`. - * The inverse edit operations will be pushed on the redo stack. - */ - undo(): Selection[]; - /** - * Redo edit operations until the next stop point created by `pushStackElement`. - * The inverse edit operations will be pushed on the undo stack. - */ - redo(): Selection[]; - /** - * Set an editable range on the model. - */ - setEditableRange(range: IRange): void; - /** - * Check if the model has an editable range. - */ - hasEditableRange(): boolean; - /** - * Get the editable range on the model. - */ - getEditableRange(): Range; } /** @@ -2294,7 +1943,7 @@ declare module monaco.editor { * Destroy this model. This will unbind the model from the mode * and make all necessary clean-up to release this object to the GC. */ - destroy(): void; + dispose(): void; /** * Search the model. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -2337,34 +1986,6 @@ declare module monaco.editor { * @return The range where the previous match is. It is null if no previous match has been found. */ findPreviousMatch(searchString: string, searchStart: IPosition, isRegex: boolean, matchCase: boolean, wholeWord: boolean): Range; - onBeforeAttached(): void; - onBeforeDetached(): void; - /** - * Returns iff this model is attached to an editor or not. - */ - isAttachedToEditor(): boolean; - } - - export interface IRangeWithText { - text: string; - range: IRange; - } - - export interface IMirrorModel extends IEventEmitter, ITokenizedModel { - getEmbeddedAtPosition(position: IPosition): IMirrorModel; - getAllEmbedded(): IMirrorModel[]; - uri: Uri; - getOffsetFromPosition(position: IPosition): number; - getPositionFromOffset(offset: number): IPosition; - getOffsetAndLengthFromRange(range: IRange): { - offset: number; - length: number; - }; - getRangeFromOffsetAndLength(offset: number, length: number): IRange; - getLineStart(lineNumber: number): number; - getAllWordsWithRange(): IRangeWithText[]; - getAllUniqueWords(skipWordOnce?: string): string[]; - getModeId(): string; } /** @@ -2625,47 +2246,11 @@ declare module monaco.editor { reason: CursorChangeReason; } - export enum VerticalRevealType { - Simple = 0, - Center = 1, - CenterIfOutsideViewport = 2, - } - - /** - * An event describing a request to reveal a specific range in the view of the editor. - */ - export interface ICursorRevealRangeEvent { - /** - * Range to be reavealed. - */ - range: Range; - /** - * View range to be reavealed. - */ - viewRange: Range; - verticalType: VerticalRevealType; - /** - * If true: there should be a horizontal & vertical revealing - * If false: there should be just a vertical revealing - */ - revealHorizontal: boolean; - } - - export interface ICursorScrollRequestEvent { - deltaLines: number; - } - export interface IModelChangedEvent { oldModelUrl: string; newModelUrl: string; } - export interface IEditorWhitespace { - id: number; - afterLineNumber: number; - heightInLines: number; - } - /** * A description for the overview ruler position. */ @@ -2985,27 +2570,16 @@ declare module monaco.editor { charChanges: ICharChange[]; } - /** - * Information about a line in the diff editor - */ - export interface IDiffLineInformation { - equivalentLineNumber: number; - } - export const KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS: string; export const KEYBINDING_CONTEXT_EDITOR_FOCUS: string; - export const KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS: string; - export const KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS: string; export const KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION: string; export const KEYBINDING_CONTEXT_EDITOR_LANGUAGE_ID: string; - export const SHOW_ACCESSIBILITY_HELP_ACTION_ID: string; - export class BareFontInfo { _bareFontInfoBrand: void; fontFamily: string; @@ -3038,161 +2612,11 @@ declare module monaco.editor { clone(): FontInfo; } - export interface IConfiguration { - onDidChange: IEvent; - editor: InternalEditorOptions; - setLineCount(lineCount: number): void; - } - - export interface IViewEventNames { - ModelFlushedEvent: string; - LinesDeletedEvent: string; - LinesInsertedEvent: string; - LineChangedEvent: string; - TokensChangedEvent: string; - DecorationsChangedEvent: string; - CursorPositionChangedEvent: string; - CursorSelectionChangedEvent: string; - RevealRangeEvent: string; - LineMappingChangedEvent: string; - } - - export var ViewEventNames: { - ModelFlushedEvent: string; - LinesDeletedEvent: string; - LinesInsertedEvent: string; - LineChangedEvent: string; - TokensChangedEvent: string; - DecorationsChangedEvent: string; - CursorPositionChangedEvent: string; - CursorSelectionChangedEvent: string; - RevealRangeEvent: string; - LineMappingChangedEvent: string; - ScrollRequestEvent: string; - }; - - export interface IScrollEvent { - scrollTop: number; - scrollLeft: number; - scrollWidth: number; - scrollHeight: number; - scrollTopChanged: boolean; - scrollLeftChanged: boolean; - scrollWidthChanged: boolean; - scrollHeightChanged: boolean; - } - export interface INewScrollPosition { scrollLeft?: number; scrollTop?: number; } - export interface IViewLinesDeletedEvent { - /** - * At what line the deletion began (inclusive). - */ - fromLineNumber: number; - /** - * At what line the deletion stopped (inclusive). - */ - toLineNumber: number; - } - - export interface IViewLinesInsertedEvent { - /** - * Before what line did the insertion begin - */ - fromLineNumber: number; - /** - * `toLineNumber` - `fromLineNumber` + 1 denotes the number of lines that were inserted - */ - toLineNumber: number; - } - - export interface IViewLineChangedEvent { - /** - * The line that has changed. - */ - lineNumber: number; - } - - export interface IViewTokensChangedEvent { - /** - * Start line number of range - */ - fromLineNumber: number; - /** - * End line number of range - */ - toLineNumber: number; - } - - export interface IViewDecorationsChangedEvent { - /** - * signals that at least one inline decoration has changed - */ - inlineDecorationsChanged: boolean; - } - - export interface IViewCursorPositionChangedEvent { - /** - * Primary cursor's position. - */ - position: Position; - /** - * Secondary cursors' position. - */ - secondaryPositions: Position[]; - /** - * Is the primary cursor in the editable range? - */ - isInEditableRange: boolean; - } - - export interface IViewCursorSelectionChangedEvent { - /** - * The primary selection. - */ - selection: Selection; - /** - * The secondary selections. - */ - secondarySelections: Selection[]; - } - - export interface IViewRevealRangeEvent { - /** - * Range to be reavealed. - */ - range: Range; - verticalType: VerticalRevealType; - /** - * If true: there should be a horizontal & vertical revealing - * If false: there should be just a vertical revealing - */ - revealHorizontal: boolean; - } - - export interface IViewScrollRequestEvent { - deltaLines: number; - } - - export interface IViewWhitespaceViewportData { - id: number; - afterLineNumber: number; - verticalOffset: number; - height: number; - } - - export class Viewport { - _viewportBrand: void; - top: number; - left: number; - width: number; - height: number; - constructor(top: number, left: number, width: number, height: number); - } - /** * Description of an action contribution */ @@ -3232,39 +2656,16 @@ declare module monaco.editor { run: (editor: ICommonCodeEditor) => TPromise; } - /** - * Data associated with an editor action contribution - */ - export interface IEditorActionDescriptorData { - id: string; - label: string; - alias?: string; - } - - export type IEditorActionContributionCtor = IConstructorSignature2; - - export type ICommonEditorContributionCtor = IConstructorSignature1; - - /** - * An editor contribution descriptor that will be used to construct editor contributions - */ - export interface ICommonEditorContributionDescriptor { - /** - * Create an instance of the contribution - */ - createInstance(instantiationService: IInstantiationService, editor: ICommonCodeEditor): IEditorContribution; - } - /** * An editor. */ export interface IEditor { - onDidModelContentChange(listener: (e: IModelContentChangedEvent) => void): IDisposable; - onDidModelModeChange(listener: (e: IModelModeChangedEvent) => void): IDisposable; - onDidModelOptionsChange(listener: (e: IModelOptionsChangedEvent) => void): IDisposable; - onDidConfigurationChange(listener: (e: IConfigurationChangedEvent) => void): IDisposable; - onDidCursorPositionChange(listener: (e: ICursorPositionChangedEvent) => void): IDisposable; - onDidCursorSelectionChange(listener: (e: ICursorSelectionChangedEvent) => void): IDisposable; + onDidChangeModelContent(listener: (e: IModelContentChangedEvent) => 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; @@ -3275,29 +2676,17 @@ declare module monaco.editor { * This is to avoid an instanceof check */ getEditorType(): string; - /** - * Destroy the editor. - */ - destroy(): void; /** * Update the editor's options after the editor has been created. */ updateOptions(newOptions: IEditorOptions): void; - /** - * Indicates that the editor becomes visible. - */ - onVisible(): void; - /** - * Indicates that the editor becomes hidden. - */ - onHide(): 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 + * Brings browser focus to the editor text */ focus(): void; /** @@ -3422,24 +2811,6 @@ declare module monaco.editor { * It is safe to call setModel(null) to simply detach the current model from the editor. */ setModel(model: IEditorModel): void; - /** - * Change the decorations. All decorations added through this changeAccessor - * will get the ownerId of the editor (meaning they will not show up in other - * editors). - * @see IModel.changeDecorations - */ - changeDecorations(callback: (changeAccessor: IModelDecorationsChangeAccessor) => any): any; - } - - export interface ICodeEditorState { - validate(editor: ICommonCodeEditor): boolean; - } - - export enum CodeEditorStateFlag { - Value = 0, - Selection = 1, - Position = 2, - Scroll = 3, } /** @@ -3464,44 +2835,14 @@ declare module monaco.editor { restoreViewState?(state: any): void; } - export interface IThemeDecorationRenderOptions { - backgroundColor?: string; - outlineColor?: string; - outlineStyle?: string; - outlineWidth?: string; - borderColor?: string; - borderRadius?: string; - borderSpacing?: string; - borderStyle?: string; - borderWidth?: string; - textDecoration?: string; - cursor?: string; - color?: string; - letterSpacing?: string; - gutterIconPath?: string; - overviewRulerColor?: string; - } - - export interface IDecorationRenderOptions extends IThemeDecorationRenderOptions { - isWholeLine?: boolean; - overviewRulerLane?: OverviewRulerLane; - light?: IThemeDecorationRenderOptions; - dark?: IThemeDecorationRenderOptions; - } - - export interface IRangeWithMessage { - range: IRange; - hoverMessage?: IHTMLContentElement[]; - } - export interface ICommonCodeEditor extends IEditor { - onDidModelChange(listener: (e: IModelChangedEvent) => void): IDisposable; - onDidModelModeSupportChange(listener: (e: IModeSupportChangedEvent) => void): IDisposable; - onDidModelDecorationsChange(listener: (e: IModelDecorationsChangedEvent) => void): IDisposable; - onDidEditorTextFocus(listener: () => void): IDisposable; - onDidEditorTextBlur(listener: () => void): IDisposable; - onDidEditorFocus(listener: () => void): IDisposable; - onDidEditorBlur(listener: () => void): IDisposable; + 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. */ @@ -3512,7 +2853,6 @@ declare module monaco.editor { * @return The contribution or null if contribution not found. */ getContribution(id: string): IEditorContribution; - captureState(...flags: CodeEditorStateFlag[]): ICodeEditorState; /** * Type the getModel() of IEditor. */ @@ -3521,10 +2861,6 @@ declare module monaco.editor { * Returns the current editor's configuration */ getConfiguration(): InternalEditorOptions; - /** - * Returns the 'raw' editor's configuration, as it was applied over the defaults, but without any computed members. - */ - getRawConfiguration(): IEditorOptions; /** * Get value of the current model attached to this editor. * @see IModel.getValue @@ -3595,33 +2931,14 @@ declare module monaco.editor { */ getLineDecorations(lineNumber: number): IModelDecoration[]; /** - * All decorations added through this call wii get the ownerId of this editor. + * All decorations added through this call will get the ownerId of this editor. * @see IModel.deltaDecorations */ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; - setDecorations(decorationTypeKey: string, ranges: IRangeWithMessage[]): void; - removeDecorations(decorationTypeKey: string): void; /** * Get the layout info for the editor. */ getLayoutInfo(): EditorLayoutInfo; - /** - * Prevent the editor from sending a widgetFocusLost event, - * set it in a state where it believes that focus is in one of its widgets. - * Use this method with care and always add a matching `endForcedWidgetFocus` - */ - beginForcedWidgetFocus(): void; - /** - * End the preventing of sending a widgetFocusLost event. - */ - endForcedWidgetFocus(): void; - /** - * This listener is notified when a keypress produces a visible character. - * The callback should not do operations on the view, as the view might not be updated to reflect previous typed characters. - * @param character Character to listen to. - * @param callback Function to call when `character` is typed. - */ - addTypingListener(character: string, callback: () => void): IDisposable; } export interface ICommonDiffEditor extends IEditor { @@ -3633,16 +2950,6 @@ declare module monaco.editor { getOriginalEditor(): ICommonCodeEditor; getModifiedEditor(): ICommonCodeEditor; getLineChanges(): ILineChange[]; - /** - * Get information based on computed diff about a line number from the original model. - * If the diff computation is not finished or the model is missing, will return null. - */ - getDiffLineInformationForOriginal(lineNumber: number): IDiffLineInformation; - /** - * Get information based on computed diff about a line number from the modified model. - * If the diff computation is not finished or the model is missing, will return null. - */ - getDiffLineInformationForModified(lineNumber: number): IDiffLineInformation; /** * @see ICodeEditor.getValue */ @@ -3650,14 +2957,6 @@ declare module monaco.editor { preserveBOM: boolean; lineEnding: string; }): string; - /** - * Returns whether the diff editor is ignoring trim whitespace or not. - */ - ignoreTrimWhitespace: boolean; - /** - * Returns whether the diff editor is rendering side by side or not. - */ - renderSideBySide: boolean; } export var EditorType: { @@ -3665,11 +2964,6 @@ declare module monaco.editor { IDiffEditor: string; }; - export var ClassName: { - EditorWarningDecoration: string; - EditorErrorDecoration: string; - }; - export var EventType: { Disposed: string; ConfigurationChanged: string; @@ -3806,118 +3100,6 @@ declare module monaco.editor { Underline = 3, } - export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): string; - - - export interface IContentWidgetData { - widget: IContentWidget; - position: IContentWidgetPosition; - } - - export interface IOverlayWidgetData { - widget: IOverlayWidget; - position: IOverlayWidgetPosition; - } - - export interface ICodeEditorHelper { - getScrollWidth(): number; - getScrollLeft(): number; - getScrollHeight(): number; - getScrollTop(): number; - setScrollPosition(position: INewScrollPosition): void; - getVerticalOffsetForPosition(lineNumber: number, column: number): number; - delegateVerticalScrollbarMouseDown(browserEvent: MouseEvent): void; - getOffsetForColumn(lineNumber: number, column: number): number; - } - - export interface IView extends IDisposable { - domNode: HTMLElement; - getInternalEventBus(): IEventEmitter; - createOverviewRuler(cssClassName: string, minimumHeight: number, maximumHeight: number): IOverviewRuler; - getCodeEditorHelper(): ICodeEditorHelper; - getCenteredRangeInViewport(): Range; - change(callback: (changeAccessor: IViewZoneChangeAccessor) => any): boolean; - getWhitespaces(): IEditorWhitespace[]; - renderOnce(callback: () => any): any; - render(now: boolean, everything: boolean): void; - setAriaActiveDescendant(id: string): void; - focus(): void; - isFocused(): boolean; - saveState(): IViewState; - restoreState(state: IViewState): void; - addContentWidget(widgetData: IContentWidgetData): void; - layoutContentWidget(widgetData: IContentWidgetData): void; - removeContentWidget(widgetData: IContentWidgetData): void; - addOverlayWidget(widgetData: IOverlayWidgetData): void; - layoutOverlayWidget(widgetData: IOverlayWidgetData): void; - removeOverlayWidget(widgetData: IOverlayWidgetData): void; - } - - export interface IViewZoneData { - viewZoneId: number; - positionBefore: Position; - positionAfter: Position; - position: Position; - afterLineNumber: number; - } - - export interface IMouseDispatchData { - position: Position; - /** - * Desired mouse column (e.g. when position.column gets clamped to text length -- clicking after text on a line). - */ - mouseColumn: number; - startedOnLineNumbers: boolean; - inSelectionMode: boolean; - mouseDownCount: number; - altKey: boolean; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - } - - export interface IViewController { - dispatchMouse(data: IMouseDispatchData): any; - moveTo(source: string, position: Position): void; - paste(source: string, text: string, pasteOnNewLine: boolean): void; - type(source: string, text: string): void; - replacePreviousChar(source: string, text: string, replaceCharCnt: number): void; - cut(source: string): void; - emitKeyDown(e: IKeyboardEvent): void; - emitKeyUp(e: IKeyboardEvent): void; - emitContextMenu(e: IEditorMouseEvent): void; - emitMouseMove(e: IEditorMouseEvent): void; - emitMouseLeave(e: IEditorMouseEvent): void; - emitMouseUp(e: IEditorMouseEvent): void; - emitMouseDown(e: IEditorMouseEvent): void; - } - - export var ClassNames: { - TEXTAREA_COVER: string; - TEXTAREA: string; - LINES_CONTENT: string; - OVERFLOW_GUARD: string; - VIEW_LINES: string; - VIEW_LINE: string; - SCROLLABLE_ELEMENT: string; - CONTENT_WIDGETS: string; - OVERFLOWING_CONTENT_WIDGETS: string; - OVERLAY_WIDGETS: string; - MARGIN_VIEW_OVERLAYS: string; - LINE_NUMBERS: string; - GLYPH_MARGIN: string; - SCROLL_DECORATION: string; - VIEW_CURSORS_LAYER: string; - VIEW_ZONES: string; - }; - - export interface IViewportInfo { - visibleRange: Range; - width: number; - height: number; - deltaTop: number; - deltaLeft: number; - } /** * A view zone is a full horizontal rectangle that 'pushes' text down. @@ -4129,57 +3311,6 @@ declare module monaco.editor { target: IMouseTarget; } - export type ISimpleEditorContributionCtor = IConstructorSignature1; - - /** - * An editor contribution descriptor that will be used to construct editor contributions - */ - export interface IEditorContributionDescriptor { - /** - * Create an instance of the contribution - */ - createInstance(instantiationService: IInstantiationService, editor: ICodeEditor): IEditorContribution; - } - - export class ColorZone { - _colorZoneBrand: void; - from: number; - to: number; - colorId: number; - position: OverviewRulerLane; - constructor(from: number, to: number, colorId: number, position: OverviewRulerLane); - } - - /** - * A zone in the overview ruler - */ - export class OverviewRulerZone { - _overviewRulerZoneBrand: void; - startLineNumber: number; - endLineNumber: number; - position: OverviewRulerLane; - forceHeight: number; - private _color; - private _darkColor; - private _colorZones; - constructor(startLineNumber: number, endLineNumber: number, position: OverviewRulerLane, forceHeight: number, color: string, darkColor: string); - getColor(useDarkColor: boolean): string; - equals(other: OverviewRulerZone): boolean; - compareTo(other: OverviewRulerZone): number; - setColorZones(colorZones: ColorZone[]): void; - getColorZones(): ColorZone[]; - } - - /** - * An overview ruler - */ - export interface IOverviewRuler { - getDomNode(): HTMLElement; - dispose(): void; - setZones(zones: OverviewRulerZone[]): void; - setLayout(position: OverviewRulerPosition): void; - } - /** * A rich code editor. */ @@ -4231,10 +3362,6 @@ declare module monaco.editor { * Returns the range that is currently centered in the view port. */ getCenteredRangeInViewport(): Range; - /** - * Get the view zones. - */ - getWhitespaces(): IEditorWhitespace[]; /** * 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). @@ -4265,11 +3392,6 @@ declare module monaco.editor { left: number; height: number; }; - /** - * Set the model ranges that will be hidden in the view. - */ - setHiddenAreas(ranges: IRange[]): void; - setAriaActiveDescendant(id: string): void; /** * Apply the same font settings as the editor to `target`. */ diff --git a/build/lib/monaco-editor.d.ts.recipe b/build/lib/monaco-editor.d.ts.recipe index ee7d8e9b47b..8e61c9056a2 100644 --- a/build/lib/monaco-editor.d.ts.recipe +++ b/build/lib/monaco-editor.d.ts.recipe @@ -1,3 +1,5 @@ +// TODO@Alex: Remove EventType, EmitterEvent, ListenerCallback, BulkListenerCallback, IEventEmitter + declare module monaco.editor { export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services?: any): ICodeEditor; @@ -7,7 +9,7 @@ declare module monaco.editor { export function createCustomMode(description:ILanguage): TPromise; export function colorize(text: string, modeId: string, options: IColorizerOptions): TPromise; export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise; - export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string; +// export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string; export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string; export function registerWorkerParticipant(modeId:string, moduleName:string, ctorName:string): void; export function configureMode(modeId: string, options: any): void; @@ -51,72 +53,43 @@ declare module monaco { dispose(): void; } - export interface IEvent { - (listener: (e: T) => any, thisArg?: any): IDisposable; - } - - export class Emitter { - constructor(); - event: IEvent; - fire(event?: T): void; - dispose(): void; - } - - #include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise - - #include(vs/base/common/uri): URI - - #include(vs/base/common/eventEmitter): EmitterEvent, ListenerCallback, BulkListenerCallback, IEventEmitter - - #include(vs/base/common/keyCodes): KeyCode, KeyMod +#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise - #include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement +#include(vs/base/common/uri): URI - #include(vs/base/common/actions): IAction +// TODO@Alex: START remove this +#include(vs/base/common/eventEmitter): EmitterEvent, ListenerCallback, BulkListenerCallback, IEventEmitter +// TODO@Alex: END remove this - #include(vs/base/browser/keyboardEvent): IKeyboardEvent +#include(vs/base/common/keyCodes): KeyCode, KeyMod - #include(vs/base/browser/mouseEvent): IMouseEvent +#include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement - export interface IPlatformServices { - } +#include(vs/base/common/actions): IAction - export interface IInstantiationService { - } +#include(vs/base/browser/keyboardEvent): IKeyboardEvent +#include(vs/base/browser/mouseEvent): IMouseEvent +#include(vs/editor/common/editorCommon): IScrollEvent - export interface IConstructorSignature1 { - new (context: IPlatformServices, first: A1): T; - } - - export interface IConstructorSignature2 { - new (context: IPlatformServices, first: A1, second: A2): T; - } - - #include(vs/editor/common/editorCommon): IPosition, IRange, SelectionDirection, ISelection - #include(vs/editor/common/core/position): Position - #include(vs/editor/common/core/range): Range - #include(vs/editor/common/core/selection): Selection +#include(vs/editor/common/editorCommon): IPosition, IRange, SelectionDirection, ISelection +#include(vs/editor/common/core/position): Position +#include(vs/editor/common/core/range): Range +#include(vs/editor/common/core/selection): Selection } declare module monaco.editor { - #include(vs/editor/common/modes/monarch/monarchTypes): ILanguage, ILanguageBracket - - #include(vs/editor/common/core/modeTransition): ModeTransition - - #include(vs/editor/common/modes): IToken, IModeTransition, ILineContext +#include(vs/editor/common/modes/monarch/monarchTypes): ILanguage, ILanguageBracket export interface IMode { } - #include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility - - #include(vs/editor/common/core/viewLineToken): ViewLineToken +#include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility - #includeAll(vs/editor/common/editorCommon): IPosition, IRange, SelectionDirection, ISelection, IFoundBracket +#includeAll(vs/editor/common/editorCommon): IPosition, IRange, ISelection, SelectionDirection, IScrollEvent - #includeAll(vs/editor/browser/editorBrowser): +#includeAll(vs/editor/browser/editorBrowser): } \ No newline at end of file diff --git a/build/lib/monaco.js b/build/lib/monaco.js index 0d31a263110..a92a6171743 100644 --- a/build/lib/monaco.js +++ b/build/lib/monaco.js @@ -28,8 +28,11 @@ function getSourceFile(moduleId) { return SOURCE_FILE_MAP[moduleId]; } function isDeclaration(a) { - var tmp = a; - return tmp.name && typeof tmp.name.text === 'string'; + return (a.kind === ts.SyntaxKind.InterfaceDeclaration + || a.kind === ts.SyntaxKind.EnumDeclaration + || a.kind === ts.SyntaxKind.ClassDeclaration + || a.kind === ts.SyntaxKind.TypeAliasDeclaration + || a.kind === ts.SyntaxKind.FunctionDeclaration); } function visitTopLevelDeclarations(sourceFile, visitor) { var stop = false; @@ -45,14 +48,13 @@ function visitTopLevelDeclarations(sourceFile, visitor) { case ts.SyntaxKind.TypeAliasDeclaration: case ts.SyntaxKind.FunctionDeclaration: stop = visitor(node); - break; - } - if (node.kind !== ts.SyntaxKind.SourceFile) { - if (getNodeText(sourceFile, node).indexOf('cursorStyleToString') >= 0) { - console.log('FOUND TEXT IN NODE: ' + ts.SyntaxKind[node.kind]); - console.log(getNodeText(sourceFile, node)); - } } + // if (node.kind !== ts.SyntaxKind.SourceFile) { + // if (getNodeText(sourceFile, node).indexOf('Handler') >= 0) { + // console.log('FOUND TEXT IN NODE: ' + ts.SyntaxKind[node.kind]); + // console.log(getNodeText(sourceFile, node)); + // } + // } if (stop) { return; } @@ -63,7 +65,21 @@ function visitTopLevelDeclarations(sourceFile, visitor) { function getAllTopLevelDeclarations(sourceFile) { var all = []; visitTopLevelDeclarations(sourceFile, function (node) { - all.push(node); + if (node.kind === ts.SyntaxKind.InterfaceDeclaration) { + var interfaceDeclaration = node; + var triviaStart = interfaceDeclaration.pos; + var triviaEnd = interfaceDeclaration.name.pos; + var triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd }); + if (triviaText.indexOf('@internal') === -1) { + all.push(node); + } + } + else { + var nodeText = getNodeText(sourceFile, node); + if (nodeText.indexOf('@internal') === -1) { + all.push(node); + } + } return false /*continue*/; }); return all; @@ -79,8 +95,15 @@ function getTopLevelDeclaration(sourceFile, typeName) { return false /*continue*/; } // node is ts.VariableStatement - return (getNodeText(sourceFile, node).indexOf(typeName) >= 0); + if (getNodeText(sourceFile, node).indexOf(typeName) >= 0) { + result = node; + return true /*stop*/; + } + return false /*continue*/; }); + if (result === null) { + console.log('COULD NOT FIND ' + typeName + '!'); + } return result; } function getNodeText(sourceFile, node) { @@ -88,6 +111,21 @@ function getNodeText(sourceFile, node) { } function getMassagedTopLevelDeclarationText(sourceFile, declaration) { var result = getNodeText(sourceFile, declaration); + if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration) { + var interfaceDeclaration = declaration; + var members = interfaceDeclaration.members; + members.forEach(function (member) { + try { + var memberText = getNodeText(sourceFile, member); + if (memberText.indexOf('@internal') >= 0) { + // console.log('BEFORE: ', result); + result = result.replace(memberText, ''); + } + } + catch (err) { + } + }); + } result = result.replace(/export default/g, 'export'); result = result.replace(/export declare/g, 'export'); return result; @@ -144,6 +182,7 @@ var result = []; lines.forEach(function (line) { var m1 = line.match(/^\s*#include\(([^\)]*)\)\:(.*)$/); if (m1) { + console.log('HANDLING META: ' + line); var moduleId = m1[1]; var sourceFile_1 = getSourceFile(moduleId); var typeNames = m1[2].split(/,/); @@ -159,24 +198,34 @@ lines.forEach(function (line) { } var m2 = line.match(/^\s*#includeAll\(([^\)]*)\)\:(.*)$/); if (m2) { + console.log('HANDLING META: ' + line); var moduleId = m2[1]; var sourceFile_2 = getSourceFile(moduleId); var typeNames = m2[2].split(/,/); - var typesToExclude_1 = {}; + var typesToExcludeMap_1 = {}; + var typesToExcludeArr_1 = []; typeNames.forEach(function (typeName) { typeName = typeName.trim(); if (typeName.length === 0) { return; } - typesToExclude_1[typeName] = true; + typesToExcludeMap_1[typeName] = true; + typesToExcludeArr_1.push(typeName); }); getAllTopLevelDeclarations(sourceFile_2).forEach(function (declaration) { if (isDeclaration(declaration)) { - if (typesToExclude_1[declaration.name.text]) { + if (typesToExcludeMap_1[declaration.name.text]) { return; } } else { + // node is ts.VariableStatement + var nodeText = getNodeText(sourceFile_2, declaration); + for (var i = 0; i < typesToExcludeArr_1.length; i++) { + if (nodeText.indexOf(typesToExcludeArr_1[i]) >= 0) { + return; + } + } } result.push(getMassagedTopLevelDeclarationText(sourceFile_2, declaration)); }); diff --git a/build/lib/monaco.ts b/build/lib/monaco.ts index 38eef06be24..5074b76ccc6 100644 --- a/build/lib/monaco.ts +++ b/build/lib/monaco.ts @@ -42,8 +42,13 @@ type TSTopLevelDeclaration = ts.InterfaceDeclaration | ts.EnumDeclaration | ts.C type TSTopLevelDeclare = TSTopLevelDeclaration | ts.VariableStatement; function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration { - let tmp = a; - return tmp.name && typeof tmp.name.text === 'string'; + return ( + a.kind === ts.SyntaxKind.InterfaceDeclaration + || a.kind === ts.SyntaxKind.EnumDeclaration + || a.kind === ts.SyntaxKind.ClassDeclaration + || a.kind === ts.SyntaxKind.TypeAliasDeclaration + || a.kind === ts.SyntaxKind.FunctionDeclaration + ); } function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTopLevelDeclare)=>boolean): void { @@ -62,15 +67,14 @@ function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTop case ts.SyntaxKind.TypeAliasDeclaration: case ts.SyntaxKind.FunctionDeclaration: stop = visitor(node); - break; } - if (node.kind !== ts.SyntaxKind.SourceFile) { - if (getNodeText(sourceFile, node).indexOf('cursorStyleToString') >= 0) { - console.log('FOUND TEXT IN NODE: ' + ts.SyntaxKind[node.kind]); - console.log(getNodeText(sourceFile, node)); - } - } + // if (node.kind !== ts.SyntaxKind.SourceFile) { + // if (getNodeText(sourceFile, node).indexOf('Handler') >= 0) { + // console.log('FOUND TEXT IN NODE: ' + ts.SyntaxKind[node.kind]); + // console.log(getNodeText(sourceFile, node)); + // } + // } if (stop) { return; @@ -85,7 +89,20 @@ function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTop function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare[] { let all:TSTopLevelDeclare[] = []; visitTopLevelDeclarations(sourceFile, (node) => { - all.push(node); + if (node.kind === ts.SyntaxKind.InterfaceDeclaration) { + let interfaceDeclaration = node; + let triviaStart = interfaceDeclaration.pos; + let triviaEnd = interfaceDeclaration.name.pos; + let triviaText = getNodeText(sourceFile, { pos: triviaStart, end: triviaEnd }); + if (triviaText.indexOf('@internal') === -1) { + all.push(node); + } + } else { + let nodeText = getNodeText(sourceFile, node); + if (nodeText.indexOf('@internal') === -1) { + all.push(node); + } + } return false /*continue*/; }); return all; @@ -103,19 +120,43 @@ function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTo return false /*continue*/; } // node is ts.VariableStatement - return (getNodeText(sourceFile, node).indexOf(typeName) >= 0); + if (getNodeText(sourceFile, node).indexOf(typeName) >= 0) { + result = node; + return true /*stop*/; + } + return false /*continue*/; }); + if (result === null) { + console.log('COULD NOT FIND ' + typeName + '!'); + } return result; } -function getNodeText(sourceFile:ts.SourceFile, node:ts.Node): string { +function getNodeText(sourceFile:ts.SourceFile, node:{pos:number; end:number;}): string { return sourceFile.getFullText().substring(node.pos, node.end); } function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaration: TSTopLevelDeclare): string { let result = getNodeText(sourceFile, declaration); + if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration) { + let interfaceDeclaration = declaration; + + let members = interfaceDeclaration.members; + members.forEach((member) => { + try { + let memberText = getNodeText(sourceFile, member); + if (memberText.indexOf('@internal') >= 0) { + // console.log('BEFORE: ', result); + result = result.replace(memberText, ''); + // console.log('AFTER: ', result); + } + } catch (err) { + // life.. + } + }); + } result = result.replace(/export default/g, 'export'); result = result.replace(/export declare/g, 'export'); return result; @@ -147,7 +188,7 @@ function format(text:string): string { for (let i = edits.length - 1; i >= 0; i--) { let change = edits[i]; let head = result.slice(0, change.span.start); - let tail = result.slice(change.span.start + change.span.length) + let tail = result.slice(change.span.start + change.span.length); result = head + change.newText + tail; } return result; @@ -183,6 +224,7 @@ lines.forEach(line => { let m1 = line.match(/^\s*#include\(([^\)]*)\)\:(.*)$/); if (m1) { + console.log('HANDLING META: ' + line); let moduleId = m1[1]; let sourceFile = getSourceFile(moduleId); @@ -200,27 +242,38 @@ lines.forEach(line => { let m2 = line.match(/^\s*#includeAll\(([^\)]*)\)\:(.*)$/); if (m2) { + console.log('HANDLING META: ' + line); let moduleId = m2[1]; let sourceFile = getSourceFile(moduleId); let typeNames = m2[2].split(/,/); - let typesToExclude: {[typeName:string]:boolean;} = {}; + let typesToExcludeMap: {[typeName:string]:boolean;} = {}; + let typesToExcludeArr: string[] = []; typeNames.forEach((typeName) => { typeName = typeName.trim(); if (typeName.length === 0) { return; } - typesToExclude[typeName] = true; + typesToExcludeMap[typeName] = true; + typesToExcludeArr.push(typeName); }); getAllTopLevelDeclarations(sourceFile).forEach((declaration) => { if (isDeclaration(declaration)) { - if (typesToExclude[declaration.name.text]) { + if (typesToExcludeMap[declaration.name.text]) { return; } } else { - // todo // node is ts.VariableStatement + let nodeText = getNodeText(sourceFile, declaration); + for (let i = 0; i < typesToExcludeArr.length; i++) { + if (nodeText.indexOf(typesToExcludeArr[i]) >= 0) { + return; + } + } + // let toExcludeArr + // console.log('TODO!!!'); + // todo // return (getNodeText(sourceFile, declaration).indexOf(typeName) >= 0); } result.push(getMassagedTopLevelDeclarationText(sourceFile, declaration)); diff --git a/src/vs/editor/browser/editorBrowser.ts b/src/vs/editor/browser/editorBrowser.ts index bf2f18a3b33..457ae7831cc 100644 --- a/src/vs/editor/browser/editorBrowser.ts +++ b/src/vs/editor/browser/editorBrowser.ts @@ -13,16 +13,25 @@ import * as editorCommon from 'vs/editor/common/editorCommon'; import {Position} from 'vs/editor/common/core/position'; import {Range} from 'vs/editor/common/core/range'; +/** + * @internal + */ export interface IContentWidgetData { widget: IContentWidget; position: IContentWidgetPosition; } +/** + * @internal + */ export interface IOverlayWidgetData { widget: IOverlayWidget; position: IOverlayWidgetPosition; } +/** + * @internal + */ export interface ICodeEditorHelper { getScrollWidth(): number; getScrollLeft(): number; @@ -37,6 +46,9 @@ export interface ICodeEditorHelper { getOffsetForColumn(lineNumber:number, column:number): number; } +/** + * @internal + */ export interface IView extends IDisposable { domNode: HTMLElement; @@ -69,6 +81,9 @@ export interface IView extends IDisposable { removeOverlayWidget(widgetData: IOverlayWidgetData): void; } +/** + * @internal + */ export interface IViewZoneData { viewZoneId: number; positionBefore:Position; @@ -77,6 +92,9 @@ export interface IViewZoneData { afterLineNumber: number; } +/** + * @internal + */ export interface IMouseDispatchData { position: Position; /** @@ -93,6 +111,9 @@ export interface IMouseDispatchData { shiftKey: boolean; } +/** + * @internal + */ export interface IViewController { dispatchMouse(data:IMouseDispatchData); @@ -112,6 +133,9 @@ export interface IViewController { emitMouseDown(e:IEditorMouseEvent): void; } +/** + * @internal + */ export var ClassNames = { TEXTAREA_COVER: 'textAreaCover', TEXTAREA: 'inputarea', @@ -131,6 +155,9 @@ export var ClassNames = { VIEW_ZONES: 'view-zones' }; +/** + * @internal + */ export interface IViewportInfo { visibleRange: Range; width:number; @@ -347,10 +374,14 @@ export interface IEditorMouseEvent { target: IMouseTarget; } +/** + * @internal + */ export type ISimpleEditorContributionCtor = IConstructorSignature1; /** * An editor contribution descriptor that will be used to construct editor contributions + * @internal */ export interface IEditorContributionDescriptor { /** @@ -362,6 +393,7 @@ export interface IEditorContributionDescriptor { /** * An overview ruler + * @internal */ export interface IOverviewRuler { getDomNode(): HTMLElement; @@ -429,6 +461,7 @@ export interface ICodeEditor extends editorCommon.ICommonCodeEditor { /** * Get the view zones. + * @internal */ getWhitespaces(): editorCommon.IEditorWhitespace[]; @@ -465,9 +498,13 @@ export interface ICodeEditor extends editorCommon.ICommonCodeEditor { /** * Set the model ranges that will be hidden in the view. + * @internal */ setHiddenAreas(ranges:editorCommon.IRange[]): void; + /** + * @internal + */ setAriaActiveDescendant(id:string): void; /** diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index 223d4b204df..535fc2af1d7 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -18,6 +18,9 @@ import {Position} from 'vs/editor/common/core/position'; import {Range} from 'vs/editor/common/core/range'; import {Selection} from 'vs/editor/common/core/selection'; +/** + * @internal + */ export interface Event { (listener: (e: T) => any, thisArg?: any): IDisposable; } @@ -992,6 +995,7 @@ export interface IModelDeltaDecoration { /** * A tracked range in the model. + * @internal */ export interface IModelTrackedRange { /** @@ -1028,6 +1032,7 @@ export interface IModelDecoration { /** * An accessor that can add, change or remove model decorations. + * @internal */ export interface IModelDecorationsChangeAccessor { /** @@ -1086,6 +1091,7 @@ export interface IWordAtPosition { /** * Range of a word inside a model. + * @internal */ export interface IWordRange { /** @@ -1098,6 +1104,9 @@ export interface IWordRange { end:number; } +/** + * @internal + */ export interface ITokenInfo { token: IToken; lineNumber: number; @@ -1105,6 +1114,9 @@ export interface ITokenInfo { endColumn: number; } +/** + * @internal + */ export interface ITokenIterator { hasNext(): boolean; next(): ITokenInfo; @@ -1160,6 +1172,7 @@ export enum EndOfLineSequence { /** * A read-only line marker in the model. + * @internal */ export interface IReadOnlyLineMarker { id: string; @@ -1241,6 +1254,7 @@ export interface ICommand { /** * A single edit operation, that acts as a simple replace. * i.e. Replace text at `range` with `text` in model. + * @internal */ export interface ISingleEditOperation { /** @@ -1298,6 +1312,7 @@ export interface ICursorStateComputer { /** * A list of tokens on a line. + * @internal */ export interface ILineTokens { getTokenCount(): number; @@ -1322,8 +1337,14 @@ export interface ILineTokens { */ findIndexOfOffset(offset:number): number; + /** + * @internal + */ sliceAndInflate(startOffset:number, endOffset:number, deltaStartIndex:number): ViewLineToken[]; + /** + * @internal + */ inflate(): ViewLineToken[]; } @@ -1419,6 +1440,7 @@ export interface ITextModel { * sit in lines with length < `LONG_LINE_BOUNDARY`. Second bucket (B) is of * characters that sit in lines with length >= `LONG_LINE_BOUNDARY`. * If count(B) > count(A) return true. Returns false otherwise. + * @internal */ isDominatedByLongLines(): boolean; @@ -1502,12 +1524,14 @@ export interface ITextModel { /** * No mode supports allowed on this model because it is simply too large. * (even tokenization would cause too much memory pressure) + * @internal */ isTooLargeForHavingAMode(): boolean; /** * Only basic mode supports allowed on this model because it is simply too large. * (tokenization is allowed and other basic supports) + * @internal */ isTooLargeForHavingARichMode(): boolean; } @@ -1537,6 +1561,9 @@ export interface IReadOnlyModel extends ITextModel { getWordUntilPosition(position:IPosition): IWordAtPosition; } +/** + * @internal + */ export interface IRichEditBracket { modeId: string; open: string; @@ -1545,6 +1572,9 @@ export interface IRichEditBracket { reversedRegex: RegExp; } +/** + * @internal + */ export interface IFoundBracket { range: Range; open: string; @@ -1561,15 +1591,20 @@ export interface ITokenizedModel extends ITextModel { * Tokenize if necessary and get the tokens for the line `lineNumber`. * @param lineNumber The line number * @param inaccurateTokensAcceptable Are inaccurate tokens acceptable? Defaults to false + * @internal */ getLineTokens(lineNumber:number, inaccurateTokensAcceptable?:boolean): ILineTokens; /** * Tokenize if necessary and get the tokenization result for the line `lineNumber`, as returned by the language mode. + * @internal */ getLineContext(lineNumber:number): ILineContext; - /*package*/_getLineModeTransitions(lineNumber:number): IModeTransition[]; + /** + * @internal + */ + _getLineModeTransitions(lineNumber:number): IModeTransition[]; /** * Get the current language mode associated with the model. @@ -1586,11 +1621,13 @@ export interface ITokenizedModel extends ITextModel { * * If there is no currently pending loading mode, then the result promise will complete immediately. * Otherwise, the result will complete once the currently pending loading mode is loaded. + * @internal */ whenModeIsReady(): TPromise; /** * Returns the true (inner-most) language mode at a given position. + * @internal */ getModeAtPosition(lineNumber:number, column:number): IMode; @@ -1615,6 +1652,7 @@ export interface ITokenizedModel extends ITextModel { * next and previous tokens from the provided position. * The iterator is made available through the callback * function and can't be used afterwards. + * @internal */ tokenIterator(position: IPosition, callback: (it: ITokenIterator) =>any): any; @@ -1623,6 +1661,7 @@ export interface ITokenizedModel extends ITextModel { * @param request The bracket we're searching for * @param position The position at which to start the search. * @return The range of the matching bracket, or null if the bracket match was not found. + * @internal */ findMatchingBracketUp(bracket:string, position:IPosition): Range; @@ -1644,6 +1683,7 @@ export interface ITokenizedModel extends ITextModel { * Given a `position`, if the position is on top or near a bracket, * find the matching bracket of that bracket and return the ranges of both brackets. * @param position The position at which to look for a bracket. + * @internal */ matchBracket(position:IPosition): [Range,Range]; } @@ -1652,16 +1692,35 @@ export interface ITokenizedModel extends ITextModel { * A model that can track markers. */ export interface ITextModelWithMarkers extends ITextModel { - /*package*/_addMarker(lineNumber:number, column:number, stickToPreviousCharacter:boolean): string; - /*package*/_changeMarker(id:string, newLineNumber:number, newColumn:number): void; - /*package*/_changeMarkerStickiness(id:string, newStickToPreviousCharacter:boolean): void; - /*package*/_getMarker(id:string): Position; - /*package*/_removeMarker(id:string): void; - /*package*/_getLineMarkers(lineNumber: number): IReadOnlyLineMarker[]; + /** + * @internal + */ + _addMarker(lineNumber:number, column:number, stickToPreviousCharacter:boolean): string; + /** + * @internal + */ + _changeMarker(id:string, newLineNumber:number, newColumn:number): void; + /** + * @internal + */ + _changeMarkerStickiness(id:string, newStickToPreviousCharacter:boolean): void; + /** + * @internal + */ + _getMarker(id:string): Position; + /** + * @internal + */ + _removeMarker(id:string): void; + /** + * @internal + */ + _getLineMarkers(lineNumber: number): IReadOnlyLineMarker[]; } /** * A map of changed ranges used during the model internal processing + * @internal */ export interface IChangedTrackedRanges { [key:string]:IRange; @@ -1683,6 +1742,7 @@ export interface ITextModelWithTrackedRanges extends ITextModel { * @param range The range to start tracking. * @param stickiness The behaviour when typing at the edges of the range. * @return A unique identifier for the tracked range. + * @internal */ addTrackedRange(range:IRange, stickiness:TrackedRangeStickiness): string; @@ -1690,6 +1750,7 @@ export interface ITextModelWithTrackedRanges extends ITextModel { * Change the range of a tracked range. * @param id The id of the tracked range, as returned by a `addTrackedRange` call. * @param newRange The new range of the tracked range. + * @internal */ changeTrackedRange(id:string, newRange:IRange): void; @@ -1697,18 +1758,21 @@ export interface ITextModelWithTrackedRanges extends ITextModel { * Change the stickiness (behaviour when typing at the edges of the range) for a tracked range. * @param id The id of the tracked range, as returned by a `addTrackedRange` call. * @param newStickiness The new behaviour when typing at the edges of the range. + * @internal */ changeTrackedRangeStickiness(id:string, newStickiness:TrackedRangeStickiness): void; /** * Remove a tracked range. * @param id The id of the tracked range, as returned by a `addTrackedRaneg` call. + * @internal */ removeTrackedRange(id:string): void; /** * Get the range of a tracked range. * @param id The id of the tracked range, as returned by a `addTrackedRaneg` call. + * @internal */ getTrackedRange(id:string): Range; @@ -1717,6 +1781,7 @@ export interface ITextModelWithTrackedRanges extends ITextModel { * @param startLineNumber The start line number * @param endLineNumber The end line number * @return An array with the tracked ranges + * @internal */ getLinesTrackedRanges(startLineNumber:number, endLineNumber:number): IModelTrackedRange[]; } @@ -1731,6 +1796,7 @@ export interface ITextModelWithDecorations { * This allows for all events to be queued up until the change * is completed. Returns whatever the callback returns. * @param ownerId Identifies the editor id in which these decorations should appear. If no `ownerId` is provided, the decorations will appear in all editors that attach this model. + * @internal */ changeDecorations(callback: (changeAccessor:IModelDecorationsChangeAccessor)=>any, ownerId?:number): any; @@ -1749,6 +1815,7 @@ export interface ITextModelWithDecorations { /** * Remove all decorations that have been added with this specific ownerId. * @param ownerId The owner id to search for. + * @internal */ removeAllDecorationsWithOwnerId(ownerId:number): void; @@ -1844,27 +1911,32 @@ export interface IEditableTextModel extends ITextModelWithMarkers { /** * Undo edit operations until the first previous stop point created by `pushStackElement`. * The inverse edit operations will be pushed on the redo stack. + * @internal */ undo(): Selection[]; /** * Redo edit operations until the next stop point created by `pushStackElement`. * The inverse edit operations will be pushed on the undo stack. + * @internal */ redo(): Selection[]; /** * Set an editable range on the model. + * @internal */ setEditableRange(range:IRange): void; /** * Check if the model has an editable range. + * @internal */ hasEditableRange(): boolean; /** * Get the editable range on the model. + * @internal */ getEditableRange(): Range; } @@ -1881,9 +1953,16 @@ export interface IModel extends IReadOnlyModel, IEditableTextModel, ITextModelWi /** * Destroy this model. This will unbind the model from the mode * and make all necessary clean-up to release this object to the GC. + * @internal */ destroy(): void; + /** + * Destroy this model. This will unbind the model from the mode + * and make all necessary clean-up to release this object to the GC. + */ + dispose(): void; + /** * Search the model. * @param searchString The string used to search. If it is a regular expression, set `isRegex` to true. @@ -1927,21 +2006,34 @@ export interface IModel extends IReadOnlyModel, IEditableTextModel, ITextModelWi */ findPreviousMatch(searchString:string, searchStart:IPosition, isRegex:boolean, matchCase:boolean, wholeWord:boolean): Range; + /** + * @internal + */ onBeforeAttached(): void; + /** + * @internal + */ onBeforeDetached(): void; /** * Returns iff this model is attached to an editor or not. + * @internal */ isAttachedToEditor(): boolean; } +/** + * @internal + */ export interface IRangeWithText { text:string; range:IRange; } +/** + * @internal + */ export interface IMirrorModel extends IEventEmitter, ITokenizedModel { getEmbeddedAtPosition(position:IPosition): IMirrorModel; getAllEmbedded(): IMirrorModel[]; @@ -2201,6 +2293,9 @@ export interface ICursorSelectionChangedEvent { */ reason:CursorChangeReason; } +/** + * @internal + */ export enum VerticalRevealType { Simple = 0, Center = 1, @@ -2208,6 +2303,7 @@ export enum VerticalRevealType { } /** * An event describing a request to reveal a specific range in the view of the editor. + * @internal */ export interface ICursorRevealRangeEvent { /** @@ -2227,6 +2323,9 @@ export interface ICursorRevealRangeEvent { revealHorizontal:boolean; } +/** + * @internal + */ export interface ICursorScrollRequestEvent { deltaLines: number; } @@ -2236,6 +2335,9 @@ export interface IModelChangedEvent { newModelUrl: string; } +/** + * @internal + */ export interface IEditorWhitespace { id:number; afterLineNumber:number; @@ -2619,6 +2721,7 @@ export interface ILineChange extends IChange { } /** * Information about a line in the diff editor + * @internal */ export interface IDiffLineInformation { equivalentLineNumber: number; @@ -2626,10 +2729,16 @@ export interface IDiffLineInformation { export const KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS = 'editorTextFocus'; export const KEYBINDING_CONTEXT_EDITOR_FOCUS = 'editorFocus'; +/** + * @internal + */ export const KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS = 'editorTabMovesFocus'; export const KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS = 'editorHasMultipleSelections'; export const KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION = 'editorHasSelection'; export const KEYBINDING_CONTEXT_EDITOR_LANGUAGE_ID = 'editorLangId'; +/** + * @internal + */ export const SHOW_ACCESSIBILITY_HELP_ACTION_ID = 'editor.action.showAccessibilityHelp'; export class BareFontInfo { @@ -2695,6 +2804,9 @@ export class FontInfo extends BareFontInfo { } } +/** + * @internal + */ export interface IConfiguration { onDidChange: Event; @@ -2705,6 +2817,9 @@ export interface IConfiguration { // --- view +/** + * @internal + */ export interface IViewEventNames { ModelFlushedEvent: string; LinesDeletedEvent: string; @@ -2718,6 +2833,9 @@ export interface IViewEventNames { LineMappingChangedEvent: string; } +/** + * @internal + */ export var ViewEventNames = { ModelFlushedEvent: 'modelFlushedEvent', LinesDeletedEvent: 'linesDeletedEvent', @@ -2749,6 +2867,9 @@ export interface INewScrollPosition { scrollTop?: number; } +/** + * @internal + */ export interface IViewLinesDeletedEvent { /** * At what line the deletion began (inclusive). @@ -2760,6 +2881,9 @@ export interface IViewLinesDeletedEvent { toLineNumber: number; } +/** + * @internal + */ export interface IViewLinesInsertedEvent { /** * Before what line did the insertion begin @@ -2771,6 +2895,9 @@ export interface IViewLinesInsertedEvent { toLineNumber: number; } +/** + * @internal + */ export interface IViewLineChangedEvent { /** * The line that has changed. @@ -2778,6 +2905,9 @@ export interface IViewLineChangedEvent { lineNumber: number; } +/** + * @internal + */ export interface IViewTokensChangedEvent { /** * Start line number of range @@ -2789,6 +2919,9 @@ export interface IViewTokensChangedEvent { toLineNumber: number; } +/** + * @internal + */ export interface IViewDecorationsChangedEvent { /** * signals that at least one inline decoration has changed @@ -2796,6 +2929,9 @@ export interface IViewDecorationsChangedEvent { inlineDecorationsChanged: boolean; } +/** + * @internal + */ export interface IViewCursorPositionChangedEvent { /** * Primary cursor's position. @@ -2811,6 +2947,9 @@ export interface IViewCursorPositionChangedEvent { isInEditableRange: boolean; } +/** + * @internal + */ export interface IViewCursorSelectionChangedEvent { /** * The primary selection. @@ -2822,6 +2961,9 @@ export interface IViewCursorSelectionChangedEvent { secondarySelections: Selection[]; } +/** + * @internal + */ export interface IViewRevealRangeEvent { /** * Range to be reavealed. @@ -2836,10 +2978,16 @@ export interface IViewRevealRangeEvent { revealHorizontal: boolean; } +/** + * @internal + */ export interface IViewScrollRequestEvent { deltaLines: number; } +/** + * @internal + */ export interface IViewWhitespaceViewportData { id:number; afterLineNumber:number; @@ -2847,6 +2995,9 @@ export interface IViewWhitespaceViewportData { height:number; } +/** + * @internal + */ export class Viewport { _viewportBrand: void; @@ -2904,6 +3055,7 @@ export interface IActionDescriptor { /** * Data associated with an editor action contribution + * @internal */ export interface IEditorActionDescriptorData { id:string; @@ -2911,12 +3063,19 @@ export interface IEditorActionDescriptorData { alias?:string; } +/** + * @internal + */ export type IEditorActionContributionCtor = IConstructorSignature2; +/** + * @internal + */ export type ICommonEditorContributionCtor = IConstructorSignature1; /** * An editor contribution descriptor that will be used to construct editor contributions + * @internal */ export interface ICommonEditorContributionDescriptor { /** @@ -2952,6 +3111,7 @@ export interface IEditor { /** * Destroy the editor. + * @internal */ destroy(): void; @@ -2962,11 +3122,13 @@ export interface IEditor { /** * Indicates that the editor becomes visible. + * @internal */ onVisible(): void; /** * Indicates that the editor becomes hidden. + * @internal */ onHide(): void; @@ -2977,7 +3139,7 @@ export interface IEditor { layout(dimension?:IDimension): void; /** - * Brings browser focus to the editor + * Brings browser focus to the editor text */ focus(): void; @@ -3136,14 +3298,21 @@ export interface IEditor { * will get the ownerId of the editor (meaning they will not show up in other * editors). * @see IModel.changeDecorations + * @internal */ changeDecorations(callback: (changeAccessor:IModelDecorationsChangeAccessor)=>any): any; } +/** + * @internal + */ export interface ICodeEditorState { validate(editor:ICommonCodeEditor): boolean; } +/** + * @internal + */ export enum CodeEditorStateFlag { Value, Selection, @@ -3173,6 +3342,9 @@ export interface IEditorContribution { restoreViewState?(state: any): void; } +/** + * @internal + */ export interface IThemeDecorationRenderOptions { backgroundColor?: string; @@ -3196,6 +3368,9 @@ export interface IThemeDecorationRenderOptions { overviewRulerColor?: string; } +/** + * @internal + */ export interface IDecorationRenderOptions extends IThemeDecorationRenderOptions { isWholeLine?: boolean; overviewRulerLane?: OverviewRulerLane; @@ -3204,6 +3379,9 @@ export interface IDecorationRenderOptions extends IThemeDecorationRenderOptions dark?: IThemeDecorationRenderOptions; } +/** + * @internal + */ export interface IRangeWithMessage { range: IRange; hoverMessage?: IHTMLContentElement[]; @@ -3233,6 +3411,9 @@ export interface ICommonCodeEditor extends IEditor { */ getContribution(id: string): IEditorContribution; + /** + * @internal + */ captureState(...flags:CodeEditorStateFlag[]): ICodeEditorState; /** @@ -3247,6 +3428,7 @@ export interface ICommonCodeEditor extends IEditor { /** * Returns the 'raw' editor's configuration, as it was applied over the defaults, but without any computed members. + * @internal */ getRawConfiguration(): IEditorOptions; @@ -3327,13 +3509,19 @@ export interface ICommonCodeEditor extends IEditor { getLineDecorations(lineNumber: number): IModelDecoration[]; /** - * All decorations added through this call wii get the ownerId of this editor. + * All decorations added through this call will get the ownerId of this editor. * @see IModel.deltaDecorations */ deltaDecorations(oldDecorations: string[], newDecorations: IModelDeltaDecoration[]): string[]; + /** + * @internal + */ setDecorations(decorationTypeKey: string, ranges:IRangeWithMessage[]): void; + /** + * @internal + */ removeDecorations(decorationTypeKey:string): void; /** @@ -3345,11 +3533,13 @@ export interface ICommonCodeEditor extends IEditor { * Prevent the editor from sending a widgetFocusLost event, * set it in a state where it believes that focus is in one of its widgets. * Use this method with care and always add a matching `endForcedWidgetFocus` + * @internal */ beginForcedWidgetFocus(): void; /** * End the preventing of sending a widgetFocusLost event. + * @internal */ endForcedWidgetFocus(): void; @@ -3358,6 +3548,7 @@ export interface ICommonCodeEditor extends IEditor { * The callback should not do operations on the view, as the view might not be updated to reflect previous typed characters. * @param character Character to listen to. * @param callback Function to call when `character` is typed. + * @internal */ addTypingListener(character: string, callback: () => void): IDisposable; @@ -3379,11 +3570,13 @@ export interface ICommonDiffEditor extends IEditor { /** * Get information based on computed diff about a line number from the original model. * If the diff computation is not finished or the model is missing, will return null. + * @internal */ getDiffLineInformationForOriginal(lineNumber:number): IDiffLineInformation; /** * Get information based on computed diff about a line number from the modified model. * If the diff computation is not finished or the model is missing, will return null. + * @internal */ getDiffLineInformationForModified(lineNumber:number): IDiffLineInformation; @@ -3394,10 +3587,12 @@ export interface ICommonDiffEditor extends IEditor { /** * Returns whether the diff editor is ignoring trim whitespace or not. + * @internal */ ignoreTrimWhitespace: boolean; /** * Returns whether the diff editor is rendering side by side or not. + * @internal */ renderSideBySide: boolean; } @@ -3407,6 +3602,9 @@ export var EditorType = { IDiffEditor: 'vs.editor.IDiffEditor' }; +/** + * @internal + */ export var ClassName = { EditorWarningDecoration: 'greensquiggly', EditorErrorDecoration: 'redsquiggly' @@ -3589,6 +3787,9 @@ export enum TextEditorCursorStyle { Underline = 3 } +/** + * @internal + */ export function cursorStyleToString(cursorStyle:TextEditorCursorStyle): string { if (cursorStyle === TextEditorCursorStyle.Line) { return 'line'; @@ -3601,6 +3802,9 @@ export function cursorStyleToString(cursorStyle:TextEditorCursorStyle): string { } } +/** + * @internal + */ export class ColorZone { _colorZoneBrand: void; @@ -3619,6 +3823,7 @@ export class ColorZone { /** * A zone in the overview ruler + * @internal */ export class OverviewRulerZone { _overviewRulerZoneBrand: void; -- GitLab