diff --git a/build/lib/compilation.js b/build/lib/compilation.js index c1a4fac020c..5e5cadf488d 100644 --- a/build/lib/compilation.js +++ b/build/lib/compilation.js @@ -199,6 +199,7 @@ class MonacoGenerator { const result = this._run(); if (!result) { // nothing really changed + this._log(`monaco.d.ts is unchanged - total time took ${Date.now() - startTime} ms`); return; } if (result.isTheSame) { @@ -206,6 +207,7 @@ class MonacoGenerator { return; } fs.writeFileSync(result.filePath, result.content); + fs.writeFileSync(path.join(REPO_SRC_FOLDER, 'vs/editor/common/standalone/standaloneEnums.ts'), result.enums); this._log(`monaco.d.ts is changed - total time took ${Date.now() - startTime} ms`); if (!this._isWatch) { this.stream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.'); diff --git a/build/lib/compilation.ts b/build/lib/compilation.ts index 936cf40f682..991e24bf78a 100644 --- a/build/lib/compilation.ts +++ b/build/lib/compilation.ts @@ -254,6 +254,7 @@ class MonacoGenerator { const result = this._run(); if (!result) { // nothing really changed + this._log(`monaco.d.ts is unchanged - total time took ${Date.now() - startTime} ms`); return; } if (result.isTheSame) { @@ -262,6 +263,7 @@ class MonacoGenerator { } fs.writeFileSync(result.filePath, result.content); + fs.writeFileSync(path.join(REPO_SRC_FOLDER, 'vs/editor/common/standalone/standaloneEnums.ts'), result.enums); this._log(`monaco.d.ts is changed - total time took ${Date.now() - startTime} ms`); if (!this._isWatch) { this.stream.emit('error', 'monaco.d.ts is no longer up to date. Please run gulp watch and commit the new file.'); diff --git a/build/monaco/api.js b/build/monaco/api.js index 7bf66ac5d7d..cc9fc40e9f6 100644 --- a/build/monaco/api.js +++ b/build/monaco/api.js @@ -120,7 +120,7 @@ function isDefaultExport(declaration) { return (hasModifier(declaration.modifiers, ts.SyntaxKind.DefaultKeyword) && hasModifier(declaration.modifiers, ts.SyntaxKind.ExportKeyword)); } -function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage) { +function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage, enums) { let result = getNodeText(sourceFile, declaration); if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) { let interfaceDeclaration = declaration; @@ -160,6 +160,10 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, } result = result.replace(/export default/g, 'export'); result = result.replace(/export declare/g, 'export'); + if (declaration.kind === ts.SyntaxKind.EnumDeclaration) { + result = result.replace(/const enum/, 'enum'); + enums.push(result); + } return result; } function format(text, endl) { @@ -318,6 +322,7 @@ function generateDeclarationFile(recipe, sourceFileGetter) { usageImports.push(`import * as ${importName} from './${moduleId.replace(/\.d\.ts$/, '')}';`); return importName; }; + let enums = []; lines.forEach(line => { let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/); if (m1) { @@ -340,7 +345,7 @@ function generateDeclarationFile(recipe, sourceFileGetter) { logErr('Cannot find type ' + typeName); return; } - result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage))); + result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage, enums))); }); return; } @@ -380,7 +385,7 @@ function generateDeclarationFile(recipe, sourceFileGetter) { } } } - result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage))); + result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage, enums))); }); return; } @@ -390,9 +395,20 @@ function generateDeclarationFile(recipe, sourceFileGetter) { resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri'); resultTxt = resultTxt.replace(/\bEventdeclaration; @@ -194,6 +194,12 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati } result = result.replace(/export default/g, 'export'); result = result.replace(/export declare/g, 'export'); + + if (declaration.kind === ts.SyntaxKind.EnumDeclaration) { + result = result.replace(/const enum/, 'enum'); + enums.push(result); + } + return result; } @@ -356,7 +362,7 @@ function createReplacer(data: string): (str: string) => string { }; } -function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGetter): [string, string] { +function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGetter): [string, string, string] { const endl = /\r\n/.test(recipe) ? '\r\n' : '\n'; let lines = recipe.split(endl); @@ -375,6 +381,8 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet return importName; }; + let enums: string[] = []; + lines.forEach(line => { let m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/); @@ -401,7 +409,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet logErr('Cannot find type ' + typeName); return; } - result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage))); + result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage, enums))); }); return; } @@ -445,7 +453,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet } } } - result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage))); + result.push(replacer(getMassagedTopLevelDeclarationText(sourceFile, declaration, importName, usage, enums))); }); return; } @@ -456,12 +464,23 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet let resultTxt = result.join(endl); resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri'); resultTxt = resultTxt.replace(/\bEvent wrapped lines begin at column 1. */ @@ -738,7 +738,7 @@ export enum WrappingIndent { /** * The kind of animation in which the editor's cursor should be rendered. */ -export enum TextEditorCursorBlinkingStyle { +export const enum TextEditorCursorBlinkingStyle { /** * Hidden */ diff --git a/src/vs/editor/common/controller/cursorEvents.ts b/src/vs/editor/common/controller/cursorEvents.ts index 750a959cf23..a873c2ed70c 100644 --- a/src/vs/editor/common/controller/cursorEvents.ts +++ b/src/vs/editor/common/controller/cursorEvents.ts @@ -9,7 +9,7 @@ import { Selection } from 'vs/editor/common/core/selection'; /** * Describes the reason the cursor has changed its position. */ -export enum CursorChangeReason { +export const enum CursorChangeReason { /** * Unknown or not set. */ diff --git a/src/vs/editor/common/core/selection.ts b/src/vs/editor/common/core/selection.ts index 8f7d468efb7..18c86628f47 100644 --- a/src/vs/editor/common/core/selection.ts +++ b/src/vs/editor/common/core/selection.ts @@ -32,7 +32,7 @@ export interface ISelection { /** * The direction of a selection. */ -export enum SelectionDirection { +export const enum SelectionDirection { /** * The selection starts above where it ends. */ diff --git a/src/vs/editor/common/model.ts b/src/vs/editor/common/model.ts index 53652c89a82..b48e4d55a57 100644 --- a/src/vs/editor/common/model.ts +++ b/src/vs/editor/common/model.ts @@ -220,7 +220,7 @@ export interface IWordAtPosition { /** * End of line character preference. */ -export enum EndOfLinePreference { +export const enum EndOfLinePreference { /** * Use the end of line character identified in the text buffer. */ @@ -238,7 +238,7 @@ export enum EndOfLinePreference { /** * The default end of line to use when instantiating models. */ -export enum DefaultEndOfLine { +export const enum DefaultEndOfLine { /** * Use line feed (\n) as the end of line character. */ @@ -252,7 +252,7 @@ export enum DefaultEndOfLine { /** * End of line character preference. */ -export enum EndOfLineSequence { +export const enum EndOfLineSequence { /** * Use line feed (\n) as the end of line character. */ @@ -437,7 +437,7 @@ export interface IFoundBracket { * Describes the behavior of decorations when typing/editing near their edges. * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` */ -export enum TrackedRangeStickiness { +export const enum TrackedRangeStickiness { AlwaysGrowsWhenTypingAtEdges = 0, NeverGrowsWhenTypingAtEdges = 1, GrowsOnlyWhenTypingBefore = 2, diff --git a/src/vs/editor/common/model/intervalTree.ts b/src/vs/editor/common/model/intervalTree.ts index 9a2723697c0..44cd8a85277 100644 --- a/src/vs/editor/common/model/intervalTree.ts +++ b/src/vs/editor/common/model/intervalTree.ts @@ -5,7 +5,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { Range } from 'vs/editor/common/core/range'; -import { IModelDecoration, TrackedRangeStickiness as ActualTrackedRangeStickiness } from 'vs/editor/common/model'; +import { IModelDecoration, TrackedRangeStickiness as ActualTrackedRangeStickiness, TrackedRangeStickiness } from 'vs/editor/common/model'; // // The red-black tree is based on the "Introduction to Algorithms" by Cormen, Leiserson and Rivest. @@ -20,17 +20,6 @@ export const enum ClassName { EditorUnnecessaryInlineDecoration = 'squiggly-inline-unnecessary' } -/** - * Describes the behavior of decorations when typing/editing near their edges. - * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` - */ -const enum TrackedRangeStickiness { - AlwaysGrowsWhenTypingAtEdges = 0, - NeverGrowsWhenTypingAtEdges = 1, - GrowsOnlyWhenTypingBefore = 2, - GrowsOnlyWhenTypingAfter = 3, -} - export const enum NodeColor { Black = 0, Red = 1, diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index ae54c9fe82a..3de90d056ab 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -254,7 +254,7 @@ export interface HoverProvider { provideHover(model: model.ITextModel, position: Position, token: CancellationToken): ProviderResult; } -export enum CompletionItemKind { +export const enum CompletionItemKind { Method, Function, Constructor, @@ -357,7 +357,7 @@ export let completionKindFromLegacyString = (function () { }; })(); -export enum CompletionItemInsertTextRule { +export const enum CompletionItemInsertTextRule { /** * Adjust whitespace/indentation of multiline insert texts to * match the current line indentation. @@ -468,7 +468,7 @@ export interface CompletionList { /** * How a suggest provider was triggered. */ -export enum CompletionTriggerKind { +export const enum CompletionTriggerKind { Invoke = 0, TriggerCharacter = 1, TriggerForIncompleteCompletions = 2 @@ -771,7 +771,7 @@ export interface TypeDefinitionProvider { /** * A symbol kind. */ -export enum SymbolKind { +export const enum SymbolKind { File = 0, Module = 1, Namespace = 2, diff --git a/src/vs/editor/common/standalone/standaloneBase.ts b/src/vs/editor/common/standalone/standaloneBase.ts index dc3aa4befc6..221d5ae04e8 100644 --- a/src/vs/editor/common/standalone/standaloneBase.ts +++ b/src/vs/editor/common/standalone/standaloneBase.ts @@ -7,32 +7,13 @@ import { Emitter } from 'vs/base/common/event'; import { KeyMod as ConstKeyMod, KeyChord } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; -import { Selection, SelectionDirection } from 'vs/editor/common/core/selection'; +import { Selection } from 'vs/editor/common/core/selection'; import { TPromise } from 'vs/base/common/winjs.base'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Token } from 'vs/editor/common/core/token'; import { URI } from 'vs/base/common/uri'; +import * as enums from 'vs/editor/common/standalone/standaloneEnums'; -// -------------------------------------------- -// This is repeated here so it can be exported -// because TS inlines const enums -// -------------------------------------------- - -export enum MarkerTag { - Unnecessary = 1, -} - -export enum MarkerSeverity { - Hint = 1, - Info = 2, - Warning = 4, - Error = 8, -} - -// -------------------------------------------- -// This is repeated here so it can be exported -// because TS inlines const enums -// -------------------------------------------- export class KeyMod { public static readonly CtrlCmd: number = ConstKeyMod.CtrlCmd; public static readonly Shift: number = ConstKeyMod.Shift; @@ -44,205 +25,20 @@ export class KeyMod { } } -// -------------------------------------------- -// This is repeated here so it can be exported -// because TS inlines const enums -// -------------------------------------------- -/** - * Virtual Key Codes, the value does not hold any inherent meaning. - * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx - * But these are "more general", as they should work across browsers & OS`s. - */ -export enum KeyCode { - /** - * Placed first to cover the 0 value of the enum. - */ - Unknown = 0, - Backspace = 1, - Tab = 2, - Enter = 3, - Shift = 4, - Ctrl = 5, - Alt = 6, - PauseBreak = 7, - CapsLock = 8, - Escape = 9, - Space = 10, - PageUp = 11, - PageDown = 12, - End = 13, - Home = 14, - LeftArrow = 15, - UpArrow = 16, - RightArrow = 17, - DownArrow = 18, - Insert = 19, - Delete = 20, - KEY_0 = 21, - KEY_1 = 22, - KEY_2 = 23, - KEY_3 = 24, - KEY_4 = 25, - KEY_5 = 26, - KEY_6 = 27, - KEY_7 = 28, - KEY_8 = 29, - KEY_9 = 30, - KEY_A = 31, - KEY_B = 32, - KEY_C = 33, - KEY_D = 34, - KEY_E = 35, - KEY_F = 36, - KEY_G = 37, - KEY_H = 38, - KEY_I = 39, - KEY_J = 40, - KEY_K = 41, - KEY_L = 42, - KEY_M = 43, - KEY_N = 44, - KEY_O = 45, - KEY_P = 46, - KEY_Q = 47, - KEY_R = 48, - KEY_S = 49, - KEY_T = 50, - KEY_U = 51, - KEY_V = 52, - KEY_W = 53, - KEY_X = 54, - KEY_Y = 55, - KEY_Z = 56, - Meta = 57, - ContextMenu = 58, - F1 = 59, - F2 = 60, - F3 = 61, - F4 = 62, - F5 = 63, - F6 = 64, - F7 = 65, - F8 = 66, - F9 = 67, - F10 = 68, - F11 = 69, - F12 = 70, - F13 = 71, - F14 = 72, - F15 = 73, - F16 = 74, - F17 = 75, - F18 = 76, - F19 = 77, - NumLock = 78, - ScrollLock = 79, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ';:' key - */ - US_SEMICOLON = 80, - /** - * For any country/region, the '+' key - * For the US standard keyboard, the '=+' key - */ - US_EQUAL = 81, - /** - * For any country/region, the ',' key - * For the US standard keyboard, the ',<' key - */ - US_COMMA = 82, - /** - * For any country/region, the '-' key - * For the US standard keyboard, the '-_' key - */ - US_MINUS = 83, - /** - * For any country/region, the '.' key - * For the US standard keyboard, the '.>' key - */ - US_DOT = 84, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '/?' key - */ - US_SLASH = 85, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '`~' key - */ - US_BACKTICK = 86, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '[{' key - */ - US_OPEN_SQUARE_BRACKET = 87, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the '\|' key - */ - US_BACKSLASH = 88, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ']}' key - */ - US_CLOSE_SQUARE_BRACKET = 89, - /** - * Used for miscellaneous characters; it can vary by keyboard. - * For the US standard keyboard, the ''"' key - */ - US_QUOTE = 90, - /** - * Used for miscellaneous characters; it can vary by keyboard. - */ - OEM_8 = 91, - /** - * Either the angle bracket key or the backslash key on the RT 102-key keyboard. - */ - OEM_102 = 92, - NUMPAD_0 = 93, - NUMPAD_1 = 94, - NUMPAD_2 = 95, - NUMPAD_3 = 96, - NUMPAD_4 = 97, - NUMPAD_5 = 98, - NUMPAD_6 = 99, - NUMPAD_7 = 100, - NUMPAD_8 = 101, - NUMPAD_9 = 102, - NUMPAD_MULTIPLY = 103, - NUMPAD_ADD = 104, - NUMPAD_SEPARATOR = 105, - NUMPAD_SUBTRACT = 106, - NUMPAD_DECIMAL = 107, - NUMPAD_DIVIDE = 108, - /** - * Cover all key codes when IME is processing input. - */ - KEY_IN_COMPOSITION = 109, - ABNT_C1 = 110, - ABNT_C2 = 111, - /** - * Placed last to cover the length of the enum. - * Please do not depend on this value! - */ - MAX_VALUE -} - export function createMonacoBaseAPI(): typeof monaco { return { editor: undefined!, // undefined override expected here languages: undefined!, // undefined override expected here CancellationTokenSource: CancellationTokenSource, Emitter: Emitter, - KeyCode: KeyCode, + KeyCode: enums.KeyCode, KeyMod: KeyMod, Position: Position, Range: Range, - Selection: Selection, - SelectionDirection: SelectionDirection, - MarkerSeverity: MarkerSeverity, - MarkerTag: MarkerTag, + Selection: Selection, + SelectionDirection: enums.SelectionDirection, + MarkerSeverity: enums.MarkerSeverity, + MarkerTag: enums.MarkerTag, Promise: TPromise, Uri: URI, Token: Token diff --git a/src/vs/editor/common/standalone/standaloneEnums.ts b/src/vs/editor/common/standalone/standaloneEnums.ts new file mode 100644 index 00000000000..265e128240d --- /dev/null +++ b/src/vs/editor/common/standalone/standaloneEnums.ts @@ -0,0 +1,651 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + + +export enum MarkerTag { + Unnecessary = 1 +} + +export enum MarkerSeverity { + Hint = 1, + Info = 2, + Warning = 4, + Error = 8 +} + +/** + * Virtual Key Codes, the value does not hold any inherent meaning. + * Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx + * But these are "more general", as they should work across browsers & OS`s. + */ +export enum KeyCode { + /** + * Placed first to cover the 0 value of the enum. + */ + Unknown = 0, + Backspace = 1, + Tab = 2, + Enter = 3, + Shift = 4, + Ctrl = 5, + Alt = 6, + PauseBreak = 7, + CapsLock = 8, + Escape = 9, + Space = 10, + PageUp = 11, + PageDown = 12, + End = 13, + Home = 14, + LeftArrow = 15, + UpArrow = 16, + RightArrow = 17, + DownArrow = 18, + Insert = 19, + Delete = 20, + KEY_0 = 21, + KEY_1 = 22, + KEY_2 = 23, + KEY_3 = 24, + KEY_4 = 25, + KEY_5 = 26, + KEY_6 = 27, + KEY_7 = 28, + KEY_8 = 29, + KEY_9 = 30, + KEY_A = 31, + KEY_B = 32, + KEY_C = 33, + KEY_D = 34, + KEY_E = 35, + KEY_F = 36, + KEY_G = 37, + KEY_H = 38, + KEY_I = 39, + KEY_J = 40, + KEY_K = 41, + KEY_L = 42, + KEY_M = 43, + KEY_N = 44, + KEY_O = 45, + KEY_P = 46, + KEY_Q = 47, + KEY_R = 48, + KEY_S = 49, + KEY_T = 50, + KEY_U = 51, + KEY_V = 52, + KEY_W = 53, + KEY_X = 54, + KEY_Y = 55, + KEY_Z = 56, + Meta = 57, + ContextMenu = 58, + F1 = 59, + F2 = 60, + F3 = 61, + F4 = 62, + F5 = 63, + F6 = 64, + F7 = 65, + F8 = 66, + F9 = 67, + F10 = 68, + F11 = 69, + F12 = 70, + F13 = 71, + F14 = 72, + F15 = 73, + F16 = 74, + F17 = 75, + F18 = 76, + F19 = 77, + NumLock = 78, + ScrollLock = 79, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the ';:' key + */ + US_SEMICOLON = 80, + /** + * For any country/region, the '+' key + * For the US standard keyboard, the '=+' key + */ + US_EQUAL = 81, + /** + * For any country/region, the ',' key + * For the US standard keyboard, the ',<' key + */ + US_COMMA = 82, + /** + * For any country/region, the '-' key + * For the US standard keyboard, the '-_' key + */ + US_MINUS = 83, + /** + * For any country/region, the '.' key + * For the US standard keyboard, the '.>' key + */ + US_DOT = 84, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the '/?' key + */ + US_SLASH = 85, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the '`~' key + */ + US_BACKTICK = 86, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the '[{' key + */ + US_OPEN_SQUARE_BRACKET = 87, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the '\|' key + */ + US_BACKSLASH = 88, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the ']}' key + */ + US_CLOSE_SQUARE_BRACKET = 89, + /** + * Used for miscellaneous characters; it can vary by keyboard. + * For the US standard keyboard, the ''"' key + */ + US_QUOTE = 90, + /** + * Used for miscellaneous characters; it can vary by keyboard. + */ + OEM_8 = 91, + /** + * Either the angle bracket key or the backslash key on the RT 102-key keyboard. + */ + OEM_102 = 92, + NUMPAD_0 = 93, + NUMPAD_1 = 94, + NUMPAD_2 = 95, + NUMPAD_3 = 96, + NUMPAD_4 = 97, + NUMPAD_5 = 98, + NUMPAD_6 = 99, + NUMPAD_7 = 100, + NUMPAD_8 = 101, + NUMPAD_9 = 102, + NUMPAD_MULTIPLY = 103, + NUMPAD_ADD = 104, + NUMPAD_SEPARATOR = 105, + NUMPAD_SUBTRACT = 106, + NUMPAD_DECIMAL = 107, + NUMPAD_DIVIDE = 108, + /** + * Cover all key codes when IME is processing input. + */ + KEY_IN_COMPOSITION = 109, + ABNT_C1 = 110, + ABNT_C2 = 111, + /** + * Placed last to cover the length of the enum. + * Please do not depend on this value! + */ + MAX_VALUE = 112 +} + +/** + * The direction of a selection. + */ +export enum SelectionDirection { + /** + * The selection starts above where it ends. + */ + LTR = 0, + /** + * The selection starts below where it ends. + */ + RTL = 1 +} + +export enum ScrollbarVisibility { + Auto = 1, + Hidden = 2, + Visible = 3 +} + +/** + * Vertical Lane in the overview ruler of the editor. + */ +export enum OverviewRulerLane { + Left = 1, + Center = 2, + Right = 4, + Full = 7 +} + +/** + * End of line character preference. + */ +export enum EndOfLinePreference { + /** + * Use the end of line character identified in the text buffer. + */ + TextDefined = 0, + /** + * Use line feed (\n) as the end of line character. + */ + LF = 1, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 2 +} + +/** + * The default end of line to use when instantiating models. + */ +export enum DefaultEndOfLine { + /** + * Use line feed (\n) as the end of line character. + */ + LF = 1, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 2 +} + +/** + * End of line character preference. + */ +export enum EndOfLineSequence { + /** + * Use line feed (\n) as the end of line character. + */ + LF = 0, + /** + * Use carriage return and line feed (\r\n) as the end of line character. + */ + CRLF = 1 +} + +/** + * Describes the behavior of decorations when typing/editing near their edges. + * Note: Please do not edit the values, as they very carefully match `DecorationRangeBehavior` + */ +export enum TrackedRangeStickiness { + AlwaysGrowsWhenTypingAtEdges = 0, + NeverGrowsWhenTypingAtEdges = 1, + GrowsOnlyWhenTypingBefore = 2, + GrowsOnlyWhenTypingAfter = 3 +} + +export enum ScrollType { + Smooth = 0, + Immediate = 1 +} + +/** + * Describes the reason the cursor has changed its position. + */ +export enum CursorChangeReason { + /** + * Unknown or not set. + */ + NotSet = 0, + /** + * A `model.setValue()` was called. + */ + ContentFlush = 1, + /** + * The `model` has been changed outside of this cursor and the cursor recovers its position from associated markers. + */ + RecoverFromMarkers = 2, + /** + * There was an explicit user gesture. + */ + Explicit = 3, + /** + * There was a Paste. + */ + Paste = 4, + /** + * There was an Undo. + */ + Undo = 5, + /** + * There was a Redo. + */ + Redo = 6 +} + +export enum RenderMinimap { + None = 0, + Small = 1, + Large = 2, + SmallBlocks = 3, + LargeBlocks = 4 +} + +/** + * Describes how to indent wrapped lines. + */ +export enum WrappingIndent { + /** + * No indentation => wrapped lines begin at column 1. + */ + None = 0, + /** + * Same => wrapped lines get the same indentation as the parent. + */ + Same = 1, + /** + * Indent => wrapped lines get +1 indentation toward the parent. + */ + Indent = 2, + /** + * DeepIndent => wrapped lines get +2 indentation toward the parent. + */ + DeepIndent = 3 +} + +/** + * The kind of animation in which the editor's cursor should be rendered. + */ +export enum TextEditorCursorBlinkingStyle { + /** + * Hidden + */ + Hidden = 0, + /** + * Blinking + */ + Blink = 1, + /** + * Blinking with smooth fading + */ + Smooth = 2, + /** + * Blinking with prolonged filled state and smooth fading + */ + Phase = 3, + /** + * Expand collapse animation on the y axis + */ + Expand = 4, + /** + * No-Blinking + */ + Solid = 5 +} + +/** + * The style in which the editor's cursor should be rendered. + */ +export enum TextEditorCursorStyle { + /** + * As a vertical line (sitting between two characters). + */ + Line = 1, + /** + * As a block (sitting on top of a character). + */ + Block = 2, + /** + * As a horizontal line (sitting under a character). + */ + Underline = 3, + /** + * As a thin vertical line (sitting between two characters). + */ + LineThin = 4, + /** + * As an outlined block (sitting on top of a character). + */ + BlockOutline = 5, + /** + * As a thin horizontal line (sitting under a character). + */ + UnderlineThin = 6 +} + +export enum RenderLineNumbersType { + Off = 0, + On = 1, + Relative = 2, + Interval = 3, + Custom = 4 +} + +/** + * A positioning preference for rendering content widgets. + */ +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 +} + +/** + * 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 +} + +/** + * Type of hit element with the mouse in the editor. + */ +export enum MouseTargetType { + /** + * Mouse is on top of an unknown element. + */ + UNKNOWN = 0, + /** + * Mouse is on top of the textarea used for input. + */ + TEXTAREA = 1, + /** + * Mouse is on top of the glyph margin + */ + GUTTER_GLYPH_MARGIN = 2, + /** + * Mouse is on top of the line numbers + */ + GUTTER_LINE_NUMBERS = 3, + /** + * Mouse is on top of the line decorations + */ + GUTTER_LINE_DECORATIONS = 4, + /** + * Mouse is on top of the whitespace left in the gutter by a view zone. + */ + GUTTER_VIEW_ZONE = 5, + /** + * Mouse is on top of text in the content. + */ + CONTENT_TEXT = 6, + /** + * Mouse is on top of empty space in the content (e.g. after line text or below last line) + */ + CONTENT_EMPTY = 7, + /** + * Mouse is on top of a view zone in the content. + */ + CONTENT_VIEW_ZONE = 8, + /** + * Mouse is on top of a content widget. + */ + CONTENT_WIDGET = 9, + /** + * Mouse is on top of the decorations overview ruler. + */ + OVERVIEW_RULER = 10, + /** + * Mouse is on top of a scrollbar. + */ + SCROLLBAR = 11, + /** + * Mouse is on top of an overlay widget. + */ + OVERLAY_WIDGET = 12, + /** + * Mouse is outside of the editor. + */ + OUTSIDE_EDITOR = 13 +} + +/** + * Describes what to do with the indentation when pressing Enter. + */ +export enum IndentAction { + /** + * Insert new line and copy the previous line's indentation. + */ + None = 0, + /** + * Insert new line and indent once (relative to the previous line's indentation). + */ + Indent = 1, + /** + * Insert two new lines: + * - the first one indented which will hold the cursor + * - the second one at the same indentation level + */ + IndentOutdent = 2, + /** + * Insert new line and outdent once (relative to the previous line's indentation). + */ + Outdent = 3 +} + +export enum CompletionItemKind { + Method = 0, + Function = 1, + Constructor = 2, + Field = 3, + Variable = 4, + Class = 5, + Struct = 6, + Interface = 7, + Module = 8, + Property = 9, + Event = 10, + Operator = 11, + Unit = 12, + Value = 13, + Constant = 14, + Enum = 15, + EnumMember = 16, + Keyword = 17, + Text = 18, + Color = 19, + File = 20, + Reference = 21, + Customcolor = 22, + Folder = 23, + TypeParameter = 24, + Snippet = 25 +} + +export enum CompletionItemInsertTextRule { + /** + * Adjust whitespace/indentation of multiline insert texts to + * match the current line indentation. + */ + KeepWhitespace = 1, + /** + * `insertText` is a snippet. + */ + InsertAsSnippet = 4 +} + +/** + * How a suggest provider was triggered. + */ +export enum CompletionTriggerKind { + Invoke = 0, + TriggerCharacter = 1, + TriggerForIncompleteCompletions = 2 +} + +export enum SignatureHelpTriggerReason { + Invoke = 1, + TriggerCharacter = 2, + Retrigger = 3 +} + +/** + * A document highlight kind. + */ +export enum DocumentHighlightKind { + /** + * A textual occurrence. + */ + Text = 0, + /** + * Read-access of a symbol, like reading a variable. + */ + Read = 1, + /** + * Write-access of a symbol, like writing to a variable. + */ + Write = 2 +} + +/** + * A symbol kind. + */ +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, + EnumMember = 21, + Struct = 22, + Event = 23, + Operator = 24, + TypeParameter = 25 +} \ No newline at end of file diff --git a/src/vs/editor/standalone/browser/standaloneEditor.ts b/src/vs/editor/standalone/browser/standaloneEditor.ts index e4e986e24ca..8aa810e0426 100644 --- a/src/vs/editor/standalone/browser/standaloneEditor.ts +++ b/src/vs/editor/standalone/browser/standaloneEditor.ts @@ -5,9 +5,8 @@ import 'vs/css!./standalone-tokens'; import * as editorCommon from 'vs/editor/common/editorCommon'; -import { ICodeEditor, ContentWidgetPositionPreference, OverlayWidgetPositionPreference, MouseTargetType } from 'vs/editor/browser/editorBrowser'; +import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { StandaloneEditor, IStandaloneCodeEditor, StandaloneDiffEditor, IStandaloneDiffEditor, IEditorConstructionOptions, IDiffEditorConstructionOptions } from 'vs/editor/standalone/browser/standaloneCodeEditor'; -import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { IEditorOverrideServices, DynamicStandaloneServices, StaticServices } from 'vs/editor/standalone/browser/standaloneServices'; import { IDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; @@ -32,10 +31,10 @@ import { IStandaloneThemeData, IStandaloneThemeService } from 'vs/editor/standal import { Token } from 'vs/editor/common/core/token'; import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo'; import * as editorOptions from 'vs/editor/common/config/editorOptions'; -import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; -import { ITextModel, OverviewRulerLane, EndOfLinePreference, DefaultEndOfLine, EndOfLineSequence, TrackedRangeStickiness, TextModelResolvedOptions, FindMatch } from 'vs/editor/common/model'; +import { ITextModel, TextModelResolvedOptions, FindMatch } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; +import * as enums from 'vs/editor/common/standalone/standaloneEnums'; function withAllStandaloneServices(domElement: HTMLElement, override: IEditorOverrideServices, callback: (services: DynamicStandaloneServices) => T): T { let services = new DynamicStandaloneServices(domElement, override); @@ -308,33 +307,6 @@ export function setTheme(themeName: string): void { StaticServices.standaloneThemeService.get().setTheme(themeName); } -/** - * @internal - * -------------------------------------------- - * This is repeated here so it can be exported - * because TS inlines const enums - * -------------------------------------------- - */ -enum ScrollType { - Smooth = 0, - Immediate = 1, -} - -/** - * @internal - * -------------------------------------------- - * This is repeated here so it can be exported - * because TS inlines const enums - * -------------------------------------------- - */ -enum RenderLineNumbersType { - Off = 0, - On = 1, - Relative = 2, - Interval = 3, - Custom = 4 -} - /** * @internal */ @@ -346,42 +318,42 @@ export function createMonacoEditorAPI(): typeof monaco.editor { createDiffEditor: createDiffEditor, createDiffNavigator: createDiffNavigator, - createModel: createModel, - setModelLanguage: setModelLanguage, - setModelMarkers: setModelMarkers, - getModelMarkers: getModelMarkers, - getModels: getModels, - getModel: getModel, - onDidCreateModel: onDidCreateModel, - onWillDisposeModel: onWillDisposeModel, - onDidChangeModelLanguage: onDidChangeModelLanguage, + createModel: createModel, + setModelLanguage: setModelLanguage, + setModelMarkers: setModelMarkers, + getModelMarkers: getModelMarkers, + getModels: getModels, + getModel: getModel, + onDidCreateModel: onDidCreateModel, + onWillDisposeModel: onWillDisposeModel, + onDidChangeModelLanguage: onDidChangeModelLanguage, - createWebWorker: createWebWorker, - colorizeElement: colorizeElement, - colorize: colorize, - colorizeModelLine: colorizeModelLine, - tokenize: tokenize, - defineTheme: defineTheme, - setTheme: setTheme, + createWebWorker: createWebWorker, + colorizeElement: colorizeElement, + colorize: colorize, + colorizeModelLine: colorizeModelLine, + tokenize: tokenize, + defineTheme: defineTheme, + setTheme: setTheme, // enums - ScrollbarVisibility: ScrollbarVisibility, - WrappingIndent: editorOptions.WrappingIndent, - OverviewRulerLane: OverviewRulerLane, - EndOfLinePreference: EndOfLinePreference, - DefaultEndOfLine: DefaultEndOfLine, - EndOfLineSequence: EndOfLineSequence, - TrackedRangeStickiness: TrackedRangeStickiness, - CursorChangeReason: CursorChangeReason, - MouseTargetType: MouseTargetType, - TextEditorCursorStyle: editorOptions.TextEditorCursorStyle, - TextEditorCursorBlinkingStyle: editorOptions.TextEditorCursorBlinkingStyle, - ContentWidgetPositionPreference: ContentWidgetPositionPreference, - OverlayWidgetPositionPreference: OverlayWidgetPositionPreference, - RenderMinimap: editorOptions.RenderMinimap, - ScrollType: ScrollType, - RenderLineNumbersType: RenderLineNumbersType, + ScrollbarVisibility: enums.ScrollbarVisibility, + WrappingIndent: enums.WrappingIndent, + OverviewRulerLane: enums.OverviewRulerLane, + EndOfLinePreference: enums.EndOfLinePreference, + DefaultEndOfLine: enums.DefaultEndOfLine, + EndOfLineSequence: enums.EndOfLineSequence, + TrackedRangeStickiness: enums.TrackedRangeStickiness, + CursorChangeReason: enums.CursorChangeReason, + MouseTargetType: enums.MouseTargetType, + TextEditorCursorStyle: enums.TextEditorCursorStyle, + TextEditorCursorBlinkingStyle: enums.TextEditorCursorBlinkingStyle, + ContentWidgetPositionPreference: enums.ContentWidgetPositionPreference, + OverlayWidgetPositionPreference: enums.OverlayWidgetPositionPreference, + RenderMinimap: enums.RenderMinimap, + ScrollType: enums.ScrollType, + RenderLineNumbersType: enums.RenderLineNumbersType, // classes InternalEditorOptions: editorOptions.InternalEditorOptions, diff --git a/src/vs/editor/standalone/browser/standaloneLanguages.ts b/src/vs/editor/standalone/browser/standaloneLanguages.ts index fdb6caba717..775fb161b56 100644 --- a/src/vs/editor/standalone/browser/standaloneLanguages.ts +++ b/src/vs/editor/standalone/browser/standaloneLanguages.ts @@ -9,7 +9,7 @@ import { IMonarchLanguage } from 'vs/editor/standalone/common/monarch/monarchTyp import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService'; import { StaticServices } from 'vs/editor/standalone/browser/standaloneServices'; import * as modes from 'vs/editor/common/modes'; -import { LanguageConfiguration, IndentAction } from 'vs/editor/common/modes/languageConfiguration'; +import { LanguageConfiguration } from 'vs/editor/common/modes/languageConfiguration'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -20,6 +20,7 @@ import { IMarkerData } from 'vs/platform/markers/common/markers'; import { Token, TokenizationResult, TokenizationResult2 } from 'vs/editor/common/core/token'; import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService'; import * as model from 'vs/editor/common/model'; +import * as enums from 'vs/editor/common/standalone/standaloneEnums'; /** * Register information about a new language. @@ -503,42 +504,44 @@ export interface CodeActionProvider { */ export function createMonacoLanguagesAPI(): typeof monaco.languages { return { - register: register, - getLanguages: getLanguages, - onLanguage: onLanguage, - getEncodedLanguageId: getEncodedLanguageId, + register: register, + getLanguages: getLanguages, + onLanguage: onLanguage, + getEncodedLanguageId: getEncodedLanguageId, // provider methods - setLanguageConfiguration: setLanguageConfiguration, - setTokensProvider: setTokensProvider, - setMonarchTokensProvider: setMonarchTokensProvider, - registerReferenceProvider: registerReferenceProvider, - registerRenameProvider: registerRenameProvider, - registerCompletionItemProvider: registerCompletionItemProvider, - registerSignatureHelpProvider: registerSignatureHelpProvider, - registerHoverProvider: registerHoverProvider, - registerDocumentSymbolProvider: registerDocumentSymbolProvider, - registerDocumentHighlightProvider: registerDocumentHighlightProvider, - registerDefinitionProvider: registerDefinitionProvider, - registerImplementationProvider: registerImplementationProvider, - registerTypeDefinitionProvider: registerTypeDefinitionProvider, - registerCodeLensProvider: registerCodeLensProvider, - registerCodeActionProvider: registerCodeActionProvider, - registerDocumentFormattingEditProvider: registerDocumentFormattingEditProvider, - registerDocumentRangeFormattingEditProvider: registerDocumentRangeFormattingEditProvider, - registerOnTypeFormattingEditProvider: registerOnTypeFormattingEditProvider, - registerLinkProvider: registerLinkProvider, - registerColorProvider: registerColorProvider, - registerFoldingRangeProvider: registerFoldingRangeProvider, + setLanguageConfiguration: setLanguageConfiguration, + setTokensProvider: setTokensProvider, + setMonarchTokensProvider: setMonarchTokensProvider, + registerReferenceProvider: registerReferenceProvider, + registerRenameProvider: registerRenameProvider, + registerCompletionItemProvider: registerCompletionItemProvider, + registerSignatureHelpProvider: registerSignatureHelpProvider, + registerHoverProvider: registerHoverProvider, + registerDocumentSymbolProvider: registerDocumentSymbolProvider, + registerDocumentHighlightProvider: registerDocumentHighlightProvider, + registerDefinitionProvider: registerDefinitionProvider, + registerImplementationProvider: registerImplementationProvider, + registerTypeDefinitionProvider: registerTypeDefinitionProvider, + registerCodeLensProvider: registerCodeLensProvider, + registerCodeActionProvider: registerCodeActionProvider, + registerDocumentFormattingEditProvider: registerDocumentFormattingEditProvider, + registerDocumentRangeFormattingEditProvider: registerDocumentRangeFormattingEditProvider, + registerOnTypeFormattingEditProvider: registerOnTypeFormattingEditProvider, + registerLinkProvider: registerLinkProvider, + registerColorProvider: registerColorProvider, + registerFoldingRangeProvider: registerFoldingRangeProvider, // enums - DocumentHighlightKind: modes.DocumentHighlightKind, - CompletionItemKind: modes.CompletionItemKind, - CompletionItemInsertTextRule: modes.CompletionItemInsertTextRule, - SymbolKind: modes.SymbolKind, - IndentAction: IndentAction, - CompletionTriggerKind: modes.CompletionTriggerKind, + DocumentHighlightKind: enums.DocumentHighlightKind, + CompletionItemKind: enums.CompletionItemKind, + CompletionItemInsertTextRule: enums.CompletionItemInsertTextRule, + SymbolKind: enums.SymbolKind, + IndentAction: enums.IndentAction, + CompletionTriggerKind: enums.CompletionTriggerKind, + SignatureHelpTriggerReason: enums.SignatureHelpTriggerReason, + + // classes FoldingRangeKind: modes.FoldingRangeKind, - SignatureHelpTriggerReason: modes.SignatureHelpTriggerReason, }; } diff --git a/src/vs/editor/test/common/standalone/standaloneBase.test.ts b/src/vs/editor/test/common/standalone/standaloneBase.test.ts deleted file mode 100644 index c28d7b164ba..00000000000 --- a/src/vs/editor/test/common/standalone/standaloneBase.test.ts +++ /dev/null @@ -1,130 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -import * as assert from 'assert'; -import { KeyCode as StandaloneKeyCode } from 'vs/editor/common/standalone/standaloneBase'; -import { KeyCode as RuntimeKeyCode } from 'vs/base/common/keyCodes'; - -suite('KeyCode', () => { - test('is exported correctly in standalone editor', () => { - - function assertKeyCode(standalone: StandaloneKeyCode, runtime: RuntimeKeyCode): void { - assert.equal(standalone, runtime); - } - - assertKeyCode(StandaloneKeyCode.Unknown, RuntimeKeyCode.Unknown); - assertKeyCode(StandaloneKeyCode.Backspace, RuntimeKeyCode.Backspace); - assertKeyCode(StandaloneKeyCode.Tab, RuntimeKeyCode.Tab); - assertKeyCode(StandaloneKeyCode.Enter, RuntimeKeyCode.Enter); - assertKeyCode(StandaloneKeyCode.Shift, RuntimeKeyCode.Shift); - assertKeyCode(StandaloneKeyCode.Ctrl, RuntimeKeyCode.Ctrl); - assertKeyCode(StandaloneKeyCode.Alt, RuntimeKeyCode.Alt); - assertKeyCode(StandaloneKeyCode.PauseBreak, RuntimeKeyCode.PauseBreak); - assertKeyCode(StandaloneKeyCode.CapsLock, RuntimeKeyCode.CapsLock); - assertKeyCode(StandaloneKeyCode.Escape, RuntimeKeyCode.Escape); - assertKeyCode(StandaloneKeyCode.Space, RuntimeKeyCode.Space); - assertKeyCode(StandaloneKeyCode.PageUp, RuntimeKeyCode.PageUp); - assertKeyCode(StandaloneKeyCode.PageDown, RuntimeKeyCode.PageDown); - assertKeyCode(StandaloneKeyCode.End, RuntimeKeyCode.End); - assertKeyCode(StandaloneKeyCode.Home, RuntimeKeyCode.Home); - assertKeyCode(StandaloneKeyCode.LeftArrow, RuntimeKeyCode.LeftArrow); - assertKeyCode(StandaloneKeyCode.UpArrow, RuntimeKeyCode.UpArrow); - assertKeyCode(StandaloneKeyCode.RightArrow, RuntimeKeyCode.RightArrow); - assertKeyCode(StandaloneKeyCode.DownArrow, RuntimeKeyCode.DownArrow); - assertKeyCode(StandaloneKeyCode.Insert, RuntimeKeyCode.Insert); - assertKeyCode(StandaloneKeyCode.Delete, RuntimeKeyCode.Delete); - assertKeyCode(StandaloneKeyCode.KEY_0, RuntimeKeyCode.KEY_0); - assertKeyCode(StandaloneKeyCode.KEY_1, RuntimeKeyCode.KEY_1); - assertKeyCode(StandaloneKeyCode.KEY_2, RuntimeKeyCode.KEY_2); - assertKeyCode(StandaloneKeyCode.KEY_3, RuntimeKeyCode.KEY_3); - assertKeyCode(StandaloneKeyCode.KEY_4, RuntimeKeyCode.KEY_4); - assertKeyCode(StandaloneKeyCode.KEY_5, RuntimeKeyCode.KEY_5); - assertKeyCode(StandaloneKeyCode.KEY_6, RuntimeKeyCode.KEY_6); - assertKeyCode(StandaloneKeyCode.KEY_7, RuntimeKeyCode.KEY_7); - assertKeyCode(StandaloneKeyCode.KEY_8, RuntimeKeyCode.KEY_8); - assertKeyCode(StandaloneKeyCode.KEY_9, RuntimeKeyCode.KEY_9); - assertKeyCode(StandaloneKeyCode.KEY_A, RuntimeKeyCode.KEY_A); - assertKeyCode(StandaloneKeyCode.KEY_B, RuntimeKeyCode.KEY_B); - assertKeyCode(StandaloneKeyCode.KEY_C, RuntimeKeyCode.KEY_C); - assertKeyCode(StandaloneKeyCode.KEY_D, RuntimeKeyCode.KEY_D); - assertKeyCode(StandaloneKeyCode.KEY_E, RuntimeKeyCode.KEY_E); - assertKeyCode(StandaloneKeyCode.KEY_F, RuntimeKeyCode.KEY_F); - assertKeyCode(StandaloneKeyCode.KEY_G, RuntimeKeyCode.KEY_G); - assertKeyCode(StandaloneKeyCode.KEY_H, RuntimeKeyCode.KEY_H); - assertKeyCode(StandaloneKeyCode.KEY_I, RuntimeKeyCode.KEY_I); - assertKeyCode(StandaloneKeyCode.KEY_J, RuntimeKeyCode.KEY_J); - assertKeyCode(StandaloneKeyCode.KEY_K, RuntimeKeyCode.KEY_K); - assertKeyCode(StandaloneKeyCode.KEY_L, RuntimeKeyCode.KEY_L); - assertKeyCode(StandaloneKeyCode.KEY_M, RuntimeKeyCode.KEY_M); - assertKeyCode(StandaloneKeyCode.KEY_N, RuntimeKeyCode.KEY_N); - assertKeyCode(StandaloneKeyCode.KEY_O, RuntimeKeyCode.KEY_O); - assertKeyCode(StandaloneKeyCode.KEY_P, RuntimeKeyCode.KEY_P); - assertKeyCode(StandaloneKeyCode.KEY_Q, RuntimeKeyCode.KEY_Q); - assertKeyCode(StandaloneKeyCode.KEY_R, RuntimeKeyCode.KEY_R); - assertKeyCode(StandaloneKeyCode.KEY_S, RuntimeKeyCode.KEY_S); - assertKeyCode(StandaloneKeyCode.KEY_T, RuntimeKeyCode.KEY_T); - assertKeyCode(StandaloneKeyCode.KEY_U, RuntimeKeyCode.KEY_U); - assertKeyCode(StandaloneKeyCode.KEY_V, RuntimeKeyCode.KEY_V); - assertKeyCode(StandaloneKeyCode.KEY_W, RuntimeKeyCode.KEY_W); - assertKeyCode(StandaloneKeyCode.KEY_X, RuntimeKeyCode.KEY_X); - assertKeyCode(StandaloneKeyCode.KEY_Y, RuntimeKeyCode.KEY_Y); - assertKeyCode(StandaloneKeyCode.KEY_Z, RuntimeKeyCode.KEY_Z); - assertKeyCode(StandaloneKeyCode.Meta, RuntimeKeyCode.Meta); - assertKeyCode(StandaloneKeyCode.ContextMenu, RuntimeKeyCode.ContextMenu); - assertKeyCode(StandaloneKeyCode.F1, RuntimeKeyCode.F1); - assertKeyCode(StandaloneKeyCode.F2, RuntimeKeyCode.F2); - assertKeyCode(StandaloneKeyCode.F3, RuntimeKeyCode.F3); - assertKeyCode(StandaloneKeyCode.F4, RuntimeKeyCode.F4); - assertKeyCode(StandaloneKeyCode.F5, RuntimeKeyCode.F5); - assertKeyCode(StandaloneKeyCode.F6, RuntimeKeyCode.F6); - assertKeyCode(StandaloneKeyCode.F7, RuntimeKeyCode.F7); - assertKeyCode(StandaloneKeyCode.F8, RuntimeKeyCode.F8); - assertKeyCode(StandaloneKeyCode.F9, RuntimeKeyCode.F9); - assertKeyCode(StandaloneKeyCode.F10, RuntimeKeyCode.F10); - assertKeyCode(StandaloneKeyCode.F11, RuntimeKeyCode.F11); - assertKeyCode(StandaloneKeyCode.F12, RuntimeKeyCode.F12); - assertKeyCode(StandaloneKeyCode.F13, RuntimeKeyCode.F13); - assertKeyCode(StandaloneKeyCode.F14, RuntimeKeyCode.F14); - assertKeyCode(StandaloneKeyCode.F15, RuntimeKeyCode.F15); - assertKeyCode(StandaloneKeyCode.F16, RuntimeKeyCode.F16); - assertKeyCode(StandaloneKeyCode.F17, RuntimeKeyCode.F17); - assertKeyCode(StandaloneKeyCode.F18, RuntimeKeyCode.F18); - assertKeyCode(StandaloneKeyCode.F19, RuntimeKeyCode.F19); - assertKeyCode(StandaloneKeyCode.NumLock, RuntimeKeyCode.NumLock); - assertKeyCode(StandaloneKeyCode.ScrollLock, RuntimeKeyCode.ScrollLock); - assertKeyCode(StandaloneKeyCode.US_SEMICOLON, RuntimeKeyCode.US_SEMICOLON); - assertKeyCode(StandaloneKeyCode.US_EQUAL, RuntimeKeyCode.US_EQUAL); - assertKeyCode(StandaloneKeyCode.US_COMMA, RuntimeKeyCode.US_COMMA); - assertKeyCode(StandaloneKeyCode.US_MINUS, RuntimeKeyCode.US_MINUS); - assertKeyCode(StandaloneKeyCode.US_DOT, RuntimeKeyCode.US_DOT); - assertKeyCode(StandaloneKeyCode.US_SLASH, RuntimeKeyCode.US_SLASH); - assertKeyCode(StandaloneKeyCode.US_BACKTICK, RuntimeKeyCode.US_BACKTICK); - assertKeyCode(StandaloneKeyCode.US_OPEN_SQUARE_BRACKET, RuntimeKeyCode.US_OPEN_SQUARE_BRACKET); - assertKeyCode(StandaloneKeyCode.US_BACKSLASH, RuntimeKeyCode.US_BACKSLASH); - assertKeyCode(StandaloneKeyCode.US_CLOSE_SQUARE_BRACKET, RuntimeKeyCode.US_CLOSE_SQUARE_BRACKET); - assertKeyCode(StandaloneKeyCode.US_QUOTE, RuntimeKeyCode.US_QUOTE); - assertKeyCode(StandaloneKeyCode.OEM_8, RuntimeKeyCode.OEM_8); - assertKeyCode(StandaloneKeyCode.OEM_102, RuntimeKeyCode.OEM_102); - assertKeyCode(StandaloneKeyCode.NUMPAD_0, RuntimeKeyCode.NUMPAD_0); - assertKeyCode(StandaloneKeyCode.NUMPAD_1, RuntimeKeyCode.NUMPAD_1); - assertKeyCode(StandaloneKeyCode.NUMPAD_2, RuntimeKeyCode.NUMPAD_2); - assertKeyCode(StandaloneKeyCode.NUMPAD_3, RuntimeKeyCode.NUMPAD_3); - assertKeyCode(StandaloneKeyCode.NUMPAD_4, RuntimeKeyCode.NUMPAD_4); - assertKeyCode(StandaloneKeyCode.NUMPAD_5, RuntimeKeyCode.NUMPAD_5); - assertKeyCode(StandaloneKeyCode.NUMPAD_6, RuntimeKeyCode.NUMPAD_6); - assertKeyCode(StandaloneKeyCode.NUMPAD_7, RuntimeKeyCode.NUMPAD_7); - assertKeyCode(StandaloneKeyCode.NUMPAD_8, RuntimeKeyCode.NUMPAD_8); - assertKeyCode(StandaloneKeyCode.NUMPAD_9, RuntimeKeyCode.NUMPAD_9); - assertKeyCode(StandaloneKeyCode.NUMPAD_MULTIPLY, RuntimeKeyCode.NUMPAD_MULTIPLY); - assertKeyCode(StandaloneKeyCode.NUMPAD_ADD, RuntimeKeyCode.NUMPAD_ADD); - assertKeyCode(StandaloneKeyCode.NUMPAD_SEPARATOR, RuntimeKeyCode.NUMPAD_SEPARATOR); - assertKeyCode(StandaloneKeyCode.NUMPAD_SUBTRACT, RuntimeKeyCode.NUMPAD_SUBTRACT); - assertKeyCode(StandaloneKeyCode.NUMPAD_DECIMAL, RuntimeKeyCode.NUMPAD_DECIMAL); - assertKeyCode(StandaloneKeyCode.NUMPAD_DIVIDE, RuntimeKeyCode.NUMPAD_DIVIDE); - assertKeyCode(StandaloneKeyCode.KEY_IN_COMPOSITION, RuntimeKeyCode.KEY_IN_COMPOSITION); - assertKeyCode(StandaloneKeyCode.ABNT_C1, RuntimeKeyCode.ABNT_C1); - assertKeyCode(StandaloneKeyCode.ABNT_C2, RuntimeKeyCode.ABNT_C2); - assertKeyCode(StandaloneKeyCode.MAX_VALUE, RuntimeKeyCode.MAX_VALUE); - }); -}); diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 9e9a4805e99..3ed51a54a04 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -25,19 +25,19 @@ declare namespace monaco { dispose(): void; } + export enum MarkerTag { - Unnecessary = 1, + Unnecessary = 1 } export enum MarkerSeverity { Hint = 1, Info = 2, Warning = 4, - Error = 8, + Error = 8 } - export class Promise { constructor(executor: (resolve: (value: T | PromiseLike) => void, reject: (reason: any) => void) => void); @@ -385,7 +385,6 @@ declare namespace monaco { */ MAX_VALUE = 112 } - export class KeyMod { static readonly CtrlCmd: number; static readonly Shift: number; @@ -1999,7 +1998,7 @@ declare namespace monaco.editor { */ export type IEditorViewState = ICodeEditorViewState | IDiffEditorViewState; - export const enum ScrollType { + export enum ScrollType { Smooth = 0, Immediate = 1 } @@ -3206,7 +3205,7 @@ declare namespace monaco.editor { readonly wordWrapBreakObtrusiveCharacters: string; } - export const enum RenderLineNumbersType { + export enum RenderLineNumbersType { Off = 0, On = 1, Relative = 2, diff --git a/src/vs/platform/markers/common/markers.ts b/src/vs/platform/markers/common/markers.ts index 511ae3053ca..dd3cc805444 100644 --- a/src/vs/platform/markers/common/markers.ts +++ b/src/vs/platform/markers/common/markers.ts @@ -37,7 +37,7 @@ export interface IRelatedInformation { endColumn: number; } -export enum MarkerTag { +export const enum MarkerTag { Unnecessary = 1, }