Add a smoketest for packaging with parcel (#3371)

* Add a smoketest for packaging with parcel

* Prevent parcel from bundling shims for `process` or `buffer`
This commit is contained in:
Alexandru Dima 2022-10-18 19:49:55 +02:00 коммит произвёл GitHub
Родитель 2b3d8516c6
Коммит 8fc2ca540c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 4398 добавлений и 101 удалений

3
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -56,6 +56,9 @@ jobs:
- name: Package using vite
run: npm run package-for-smoketest-vite
- name: Package using parcel
run: npm run package-for-smoketest-parcel --prefix test/smoke/parcel
- name: Run smoke test
run: npm run smoketest

2
.gitignore поставляемый
Просмотреть файл

@ -3,3 +3,5 @@
**/release/
/test/manual/generated/**
/test/smoke/vite/dist/**
/test/smoke/parcel/dist/**
/test/smoke/parcel/.cache/**

Просмотреть файл

@ -1,5 +1,10 @@
# Monaco Editor Changelog
## [0.35.1]
- Adds sticky scrolling
- Renamed the option `enableDropIntoEditor` to `dropIntoEditor`
## [0.34.1]
- Adds API to register global actions, commands, or keybinding rules

3963
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -49,7 +49,8 @@
"jsdom": "^19.0.0",
"jsonc-parser": "^3.0.0",
"mocha": "^9.2.0",
"monaco-editor-core": "0.34.0-dev.20220720",
"monaco-editor-core": "0.35.0-dev.20221018.2",
"parcel": "^2.7.0",
"playwright": "^1.18.1",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
@ -68,5 +69,9 @@
"vscode-uri": "3.0.3",
"webpack": "^5.74.0",
"yaserver": "^0.4.0"
},
"alias": {
"process": false,
"buffer": false
}
}

Просмотреть файл

@ -487,7 +487,7 @@ export function create(ctx: worker.IWorkerContext, createData: ICreateData): Typ
'Monaco is not using webworkers for background tasks, and that is needed to support the customWorkerPath flag'
);
} else {
importScripts(createData.customWorkerPath);
self.importScripts(createData.customWorkerPath);
const workerFactoryFunc: CustomTSWebWorkerFactory | undefined = self.customTSWorkerFactory;
if (!workerFactoryFunc) {

Просмотреть файл

@ -7,5 +7,5 @@
exports.__nothing = undefined;
/** @typedef {'chromium'|'firefox'|'webkit'} BrowserKind */
/** @typedef {'amd'|'webpack'|'esbuild'|'vite'} PackagerKind */
/** @typedef {'amd'|'webpack'|'esbuild'|'vite'|'parcel'} PackagerKind */
/** @typedef {{browser:BrowserKind; packager:PackagerKind; debugTests:boolean; port:number;}} TestInfo */

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<div id="editor-container" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
<script type="module" src="index.js"></script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,35 @@
import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
self.MonacoEnvironment = {
getWorker: function (moduleId, label) {
if (label === 'json') {
return new Worker(
new URL('../../../release/esm/vs/language/json/json.worker.js', import.meta.url),
{ type: 'module' }
);
}
if (label === 'css' || label === 'scss' || label === 'less') {
return new Worker(
new URL('../../../release/esm/vs/language/css/css.worker.js', import.meta.url),
{ type: 'module' }
);
}
if (label === 'html' || label === 'handlebars' || label === 'razor') {
return new Worker(
new URL('../../../release/esm/vs/language/html/html.worker.js', import.meta.url),
{ type: 'module' }
);
}
if (label === 'typescript' || label === 'javascript') {
return new Worker(
new URL('../../../release/esm/vs/language/typescript/ts.worker.js', import.meta.url),
{ type: 'module' }
);
}
return new Worker(new URL('../../../release/esm/vs/editor/editor.worker.js', import.meta.url), {
type: 'module'
});
}
};
window.monacoAPI = monaco;

Просмотреть файл

@ -0,0 +1,6 @@
{
"name": "parcel-smoketest",
"scripts": {
"package-for-smoketest-parcel": "parcel build ./index.html --cache-dir ./.cache --public-url /test/smoke/parcel/dist/ --no-optimize"
}
}

Просмотреть файл

@ -42,7 +42,7 @@ async function runTests() {
// uncomment to shortcircuit and run a specific combo
// await runTest('webpack', 'chromium'); return;
/** @type {PackagerKind[]} */
const testTypes = ['amd', 'webpack', 'esbuild', 'vite'];
const testTypes = ['amd', 'webpack', 'esbuild', 'vite', 'parcel'];
for (const type of testTypes) {
await runTest(type, 'chromium');

Просмотреть файл

@ -19,7 +19,8 @@ const URLS = {
amd: `http://127.0.0.1:${testInfo.port}/test/smoke/amd/index.html`,
webpack: `http://127.0.0.1:${testInfo.port}/test/smoke/webpack/index.html`,
esbuild: `http://127.0.0.1:${testInfo.port}/test/smoke/esbuild/index.html`,
vite: `http://127.0.0.1:${testInfo.port}/test/smoke/vite/dist/index.html`
vite: `http://127.0.0.1:${testInfo.port}/test/smoke/vite/dist/index.html`,
parcel: `http://127.0.0.1:${testInfo.port}/test/smoke/parcel/dist/index.html`
};
const URL = URLS[testInfo.packager];
@ -107,11 +108,11 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
await page.evaluate(`window.ed.focus();`);
}
test('`monacoAPI` is exposed as global', async () => {
test('`monacoAPI` is exposed as global', async function () {
assert.strictEqual(await page.evaluate(`typeof monacoAPI`), 'object');
});
test('should be able to create plaintext editor', async () => {
test('should be able to create plaintext editor', async function () {
await createEditor('hello world', 'plaintext');
// type a link in it
@ -122,14 +123,14 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
await page.waitForSelector('.detected-link');
});
test('css smoke test', async () => {
test('css smoke test', async function () {
await createEditor('.sel1 { background: red; }\\n.sel2 {}', 'css');
// check that a squiggle appears, which indicates that the language service is up and running
await page.waitForSelector('.squiggly-warning');
});
test('html smoke test', async () => {
test('html smoke test', async function () {
await createEditor('<title>hi</title>', 'html');
// we need to try this a couple of times because the web worker might not be ready yet
@ -151,7 +152,7 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
}
});
test('json smoke test', async () => {
test('json smoke test', async function () {
await createEditor('{}', 'json');
// we need to try this a couple of times because the web worker might not be ready yet
@ -168,7 +169,7 @@ suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
}
});
test('typescript smoke test', async () => {
test('typescript smoke test', async function () {
await createEditor('window.add', 'typescript');
// check that a squiggle appears, which indicates that the language service is up and running

Просмотреть файл

@ -705,6 +705,10 @@ declare namespace monaco {
* Create a new empty range using this range's start position.
*/
collapseToStart(): Range;
/**
* Moves the range by the given amount of lines.
*/
delta(lineCount: number): Range;
/**
* Create a new empty range using this range's start position.
*/
@ -926,6 +930,50 @@ declare namespace monaco.editor {
export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: IDiffNavigatorOptions): IDiffNavigator;
/**
* Description of a command contribution
*/
export interface ICommandDescriptor {
/**
* An unique identifier of the contributed command.
*/
id: string;
/**
* Callback that will be executed when the command is triggered.
*/
run: ICommandHandler;
}
/**
* Add a command.
*/
export function addCommand(descriptor: ICommandDescriptor): IDisposable;
/**
* Add an action to all editors.
*/
export function addEditorAction(descriptor: IActionDescriptor): IDisposable;
/**
* A keybinding rule.
*/
export interface IKeybindingRule {
keybinding: number;
command?: string | null;
commandArgs?: any;
when?: string | null;
}
/**
* Add a keybinding rule.
*/
export function addKeybindingRule(rule: IKeybindingRule): IDisposable;
/**
* Add keybinding rules.
*/
export function addKeybindingRules(rules: IKeybindingRule[]): IDisposable;
/**
* Create a new editor model.
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
@ -1489,6 +1537,11 @@ declare namespace monaco.editor {
*/
className?: string | null;
blockClassName?: string | null;
/**
* Indicates if this block should be rendered after the last line.
* In this case, the range must be empty and set to the last line.
*/
blockIsAfterEnd?: boolean | null;
/**
* Message to be rendered when hovering over the glyph margin decoration.
*/
@ -1501,6 +1554,10 @@ declare namespace monaco.editor {
* Should the decoration expand to encompass a whole line.
*/
isWholeLine?: boolean;
/**
* Always render the decoration (even when the range it encompasses is collapsed).
*/
showIfCollapsed?: boolean;
/**
* Specifies the stack order of a decoration.
* A decoration with greater stack order is always in front of a decoration with
@ -1743,6 +1800,15 @@ declare namespace monaco.editor {
GrowsOnlyWhenTypingAfter = 3
}
/**
* Text snapshot that works like an iterator.
* Will try to return chunks of roughly ~64KB size.
* Will return null when finished.
*/
export interface ITextSnapshot {
read(): string | null;
}
/**
* A model.
*/
@ -1774,7 +1840,7 @@ declare namespace monaco.editor {
/**
* Replace the entire text buffer value contained in this model.
*/
setValue(newValue: string): void;
setValue(newValue: string | ITextSnapshot): void;
/**
* Get the text stored in this model.
* @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
@ -1782,6 +1848,12 @@ declare namespace monaco.editor {
* @return The text.
*/
getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
/**
* Get the text stored in this model.
* @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
* @return The text snapshot (it is safe to consume it asynchronously).
*/
createSnapshot(preserveBOM?: boolean): ITextSnapshot;
/**
* Get the length of the text stored in this model.
*/
@ -2000,7 +2072,7 @@ declare namespace monaco.editor {
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
* @return An array with the decorations
*/
getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[];
/**
* Gets all the decorations as an array.
* @param ownerId If set, it will ignore decorations belonging to other owners.
@ -2616,6 +2688,10 @@ declare namespace monaco.editor {
* New language
*/
readonly newLanguage: string;
/**
* Source of the call that caused the event.
*/
readonly source: string;
}
/**
@ -2936,6 +3012,10 @@ declare namespace monaco.editor {
* Control the behavior and rendering of the scrollbars.
*/
scrollbar?: IEditorScrollbarOptions;
/**
* Control the behavior of sticky scroll options
*/
stickyScroll?: IEditorStickyScrollOptions;
/**
* Control the behavior and rendering of the minimap.
*/
@ -3025,8 +3105,7 @@ declare namespace monaco.editor {
*/
smoothScrolling?: boolean;
/**
* Enable that the editor will install an interval to check if its container dom node size has changed.
* Enabling this might have a severe performance impact.
* Enable that the editor will install a ResizeObserver to check if its container dom node size has changed.
* Defaults to false.
*/
automaticLayout?: boolean;
@ -3403,6 +3482,10 @@ declare namespace monaco.editor {
* Controls strikethrough deprecated variables.
*/
showDeprecated?: boolean;
/**
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
*/
matchOnWordStartOnly?: boolean;
/**
* Control the behavior and rendering of the inline hints.
*/
@ -3425,11 +3508,11 @@ declare namespace monaco.editor {
*/
bracketPairColorization?: IBracketPairColorizationOptions;
/**
* Enables dropping into the editor from an external source.
* Controls dropping into the editor from an external source.
*
* This shows a preview of the drop location and triggers an `onDropIntoEditor` event.
* When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.
*/
enableDropIntoEditor?: boolean;
dropIntoEditor?: IDropIntoEditorOptions;
}
export interface IDiffEditorBaseOptions {
@ -3487,6 +3570,10 @@ declare namespace monaco.editor {
* Control the wrapping of the diff editor.
*/
diffWordWrap?: 'off' | 'on' | 'inherit';
/**
* Diff Algorithm
*/
diffAlgorithm?: 'smart' | 'experimental';
}
/**
@ -3794,6 +3881,17 @@ declare namespace monaco.editor {
enabled?: boolean;
}
export interface IEditorStickyScrollOptions {
/**
* Enable the sticky scroll
*/
enabled?: boolean;
/**
* Maximum number of sticky lines to show
*/
maxLineCount?: number;
}
/**
* Configuration options for editor inlayHints
*/
@ -4175,6 +4273,10 @@ declare namespace monaco.editor {
* Show deprecated-suggestions.
*/
showDeprecated?: boolean;
/**
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
*/
matchOnWordStartOnly?: boolean;
/**
* Show field-suggestions.
*/
@ -4306,6 +4408,17 @@ declare namespace monaco.editor {
readonly wrappingColumn: number;
}
/**
* Configuration options for editor drop into behavior
*/
export interface IDropIntoEditorOptions {
/**
* Enable the dropping into editor.
* Defaults to true.
*/
enabled?: boolean;
}
export enum EditorOption {
acceptSuggestionOnCommitCharacter = 0,
acceptSuggestionOnEnter = 1,
@ -4339,7 +4452,7 @@ declare namespace monaco.editor {
disableMonospaceOptimizations = 29,
domReadOnly = 30,
dragAndDrop = 31,
enableDropIntoEditor = 32,
dropIntoEditor = 32,
emptySelectionClipboard = 33,
extraEditorClassName = 34,
fastScrollSensitivity = 35,
@ -4412,35 +4525,36 @@ declare namespace monaco.editor {
snippetSuggestions = 102,
smartSelect = 103,
smoothScrolling = 104,
stickyTabStops = 105,
stopRenderingLineAfter = 106,
suggest = 107,
suggestFontSize = 108,
suggestLineHeight = 109,
suggestOnTriggerCharacters = 110,
suggestSelection = 111,
tabCompletion = 112,
tabIndex = 113,
unicodeHighlighting = 114,
unusualLineTerminators = 115,
useShadowDOM = 116,
useTabStops = 117,
wordSeparators = 118,
wordWrap = 119,
wordWrapBreakAfterCharacters = 120,
wordWrapBreakBeforeCharacters = 121,
wordWrapColumn = 122,
wordWrapOverride1 = 123,
wordWrapOverride2 = 124,
wrappingIndent = 125,
wrappingStrategy = 126,
showDeprecated = 127,
inlayHints = 128,
editorClassName = 129,
pixelRatio = 130,
tabFocusMode = 131,
layoutInfo = 132,
wrappingInfo = 133
stickyScroll = 105,
stickyTabStops = 106,
stopRenderingLineAfter = 107,
suggest = 108,
suggestFontSize = 109,
suggestLineHeight = 110,
suggestOnTriggerCharacters = 111,
suggestSelection = 112,
tabCompletion = 113,
tabIndex = 114,
unicodeHighlighting = 115,
unusualLineTerminators = 116,
useShadowDOM = 117,
useTabStops = 118,
wordSeparators = 119,
wordWrap = 120,
wordWrapBreakAfterCharacters = 121,
wordWrapBreakBeforeCharacters = 122,
wordWrapColumn = 123,
wordWrapOverride1 = 124,
wordWrapOverride2 = 125,
wrappingIndent = 126,
wrappingStrategy = 127,
showDeprecated = 128,
inlayHints = 129,
editorClassName = 130,
pixelRatio = 131,
tabFocusMode = 132,
layoutInfo = 133,
wrappingInfo = 134
}
export const EditorOptions: {
@ -4478,7 +4592,8 @@ declare namespace monaco.editor {
domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
enableDropIntoEditor: IEditorOption<EditorOption.enableDropIntoEditor, boolean>;
dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
stickyScroll: IEditorOption<EditorOption.stickyScroll, Readonly<Required<IEditorStickyScrollOptions>>>;
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
@ -4984,6 +5099,8 @@ declare namespace monaco.editor {
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
readonly type: MouseTargetType.OUTSIDE_EDITOR;
readonly outsidePosition: 'above' | 'below' | 'left' | 'right';
readonly outsideDistance: number;
}
/**
@ -5278,7 +5395,7 @@ declare namespace monaco.editor {
* @id Unique identifier of the contribution.
* @return The action or null if action not found.
*/
getAction(id: string): IEditorAction;
getAction(id: string): IEditorAction | null;
/**
* Execute a command on the editor.
* The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
@ -5335,9 +5452,13 @@ declare namespace monaco.editor {
*/
getVisibleRanges(): Range[];
/**
* Get the vertical position (top offset) for the line w.r.t. to the first line.
* Get the vertical position (top offset) for the line's top w.r.t. to the first line.
*/
getTopForLineNumber(lineNumber: number): number;
/**
* Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.
*/
getBottomForLineNumber(lineNumber: number): number;
/**
* Get the vertical position (top offset) for the position w.r.t. to the first line.
*/
@ -5436,6 +5557,11 @@ declare namespace monaco.editor {
* @event
*/
readonly onDidUpdateDiff: IEvent<void>;
/**
* An event emitted when the diff model is changed (i.e. the diff editor shows new content).
* @event
*/
readonly onDidChangeModel: IEvent<void>;
/**
* Saves current view state of the editor in a serializable object.
*/
@ -5838,6 +5964,10 @@ declare namespace monaco.languages {
* Requested kind of actions to return.
*/
readonly only?: string;
/**
* The reason why code actions were requested.
*/
readonly trigger: CodeActionTriggerType;
}
/**
@ -5868,6 +5998,10 @@ declare namespace monaco.languages {
* such as `["quickfix.removeLine", "source.fixAll" ...]`.
*/
readonly providedCodeActionKinds?: readonly string[];
readonly documentation?: ReadonlyArray<{
readonly kind: string;
readonly command: Command;
}>;
}
/**
@ -6440,6 +6574,11 @@ declare namespace monaco.languages {
disabled?: string;
}
export enum CodeActionTriggerType {
Invoke = 1,
Auto = 2
}
export interface CodeActionList extends IDisposable {
readonly actions: ReadonlyArray<CodeAction>;
}
@ -6776,11 +6915,11 @@ declare namespace monaco.languages {
provideDocumentSymbols(model: editor.ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;
}
export type TextEdit = {
export interface TextEdit {
range: IRange;
text: string;
eol?: editor.EndOfLineSequence;
};
}
/**
* Interface used to format a model
@ -7018,6 +7157,7 @@ declare namespace monaco.languages {
folder?: boolean;
skipTrashBin?: boolean;
maxSize?: number;
contentsBase64?: string;
}
export interface IWorkspaceFileEdit {

222
website/typedoc/monaco.d.ts поставляемый
Просмотреть файл

@ -705,6 +705,10 @@ declare namespace monaco {
* Create a new empty range using this range's start position.
*/
collapseToStart(): Range;
/**
* Moves the range by the given amount of lines.
*/
delta(lineCount: number): Range;
/**
* Create a new empty range using this range's start position.
*/
@ -926,6 +930,50 @@ declare namespace monaco.editor {
export function createDiffNavigator(diffEditor: IStandaloneDiffEditor, opts?: IDiffNavigatorOptions): IDiffNavigator;
/**
* Description of a command contribution
*/
export interface ICommandDescriptor {
/**
* An unique identifier of the contributed command.
*/
id: string;
/**
* Callback that will be executed when the command is triggered.
*/
run: ICommandHandler;
}
/**
* Add a command.
*/
export function addCommand(descriptor: ICommandDescriptor): IDisposable;
/**
* Add an action to all editors.
*/
export function addEditorAction(descriptor: IActionDescriptor): IDisposable;
/**
* A keybinding rule.
*/
export interface IKeybindingRule {
keybinding: number;
command?: string | null;
commandArgs?: any;
when?: string | null;
}
/**
* Add a keybinding rule.
*/
export function addKeybindingRule(rule: IKeybindingRule): IDisposable;
/**
* Add keybinding rules.
*/
export function addKeybindingRules(rules: IKeybindingRule[]): IDisposable;
/**
* Create a new editor model.
* You can specify the language that should be set for this model or let the language be inferred from the `uri`.
@ -1489,6 +1537,11 @@ declare namespace monaco.editor {
*/
className?: string | null;
blockClassName?: string | null;
/**
* Indicates if this block should be rendered after the last line.
* In this case, the range must be empty and set to the last line.
*/
blockIsAfterEnd?: boolean | null;
/**
* Message to be rendered when hovering over the glyph margin decoration.
*/
@ -1501,6 +1554,10 @@ declare namespace monaco.editor {
* Should the decoration expand to encompass a whole line.
*/
isWholeLine?: boolean;
/**
* Always render the decoration (even when the range it encompasses is collapsed).
*/
showIfCollapsed?: boolean;
/**
* Specifies the stack order of a decoration.
* A decoration with greater stack order is always in front of a decoration with
@ -1743,6 +1800,15 @@ declare namespace monaco.editor {
GrowsOnlyWhenTypingAfter = 3
}
/**
* Text snapshot that works like an iterator.
* Will try to return chunks of roughly ~64KB size.
* Will return null when finished.
*/
export interface ITextSnapshot {
read(): string | null;
}
/**
* A model.
*/
@ -1774,7 +1840,7 @@ declare namespace monaco.editor {
/**
* Replace the entire text buffer value contained in this model.
*/
setValue(newValue: string): void;
setValue(newValue: string | ITextSnapshot): void;
/**
* Get the text stored in this model.
* @param eol The end of line character preference. Defaults to `EndOfLinePreference.TextDefined`.
@ -1782,6 +1848,12 @@ declare namespace monaco.editor {
* @return The text.
*/
getValue(eol?: EndOfLinePreference, preserveBOM?: boolean): string;
/**
* Get the text stored in this model.
* @param preserverBOM Preserve a BOM character if it was detected when the model was constructed.
* @return The text snapshot (it is safe to consume it asynchronously).
*/
createSnapshot(preserveBOM?: boolean): ITextSnapshot;
/**
* Get the length of the text stored in this model.
*/
@ -2000,7 +2072,7 @@ declare namespace monaco.editor {
* @param filterOutValidation If set, it will ignore decorations specific to validation (i.e. warnings, errors).
* @return An array with the decorations
*/
getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean): IModelDecoration[];
getDecorationsInRange(range: IRange, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[];
/**
* Gets all the decorations as an array.
* @param ownerId If set, it will ignore decorations belonging to other owners.
@ -2616,6 +2688,10 @@ declare namespace monaco.editor {
* New language
*/
readonly newLanguage: string;
/**
* Source of the call that caused the event.
*/
readonly source: string;
}
/**
@ -2936,6 +3012,10 @@ declare namespace monaco.editor {
* Control the behavior and rendering of the scrollbars.
*/
scrollbar?: IEditorScrollbarOptions;
/**
* Control the behavior of sticky scroll options
*/
stickyScroll?: IEditorStickyScrollOptions;
/**
* Control the behavior and rendering of the minimap.
*/
@ -3026,7 +3106,6 @@ declare namespace monaco.editor {
smoothScrolling?: boolean;
/**
* Enable that the editor will install a ResizeObserver to check if its container dom node size has changed.
* Enabling this might have a severe performance impact.
* Defaults to false.
*/
automaticLayout?: boolean;
@ -3403,6 +3482,10 @@ declare namespace monaco.editor {
* Controls strikethrough deprecated variables.
*/
showDeprecated?: boolean;
/**
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
*/
matchOnWordStartOnly?: boolean;
/**
* Control the behavior and rendering of the inline hints.
*/
@ -3425,11 +3508,11 @@ declare namespace monaco.editor {
*/
bracketPairColorization?: IBracketPairColorizationOptions;
/**
* Enables dropping into the editor from an external source.
* Controls dropping into the editor from an external source.
*
* This shows a preview of the drop location and triggers an `onDropIntoEditor` event.
* When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.
*/
enableDropIntoEditor?: boolean;
dropIntoEditor?: IDropIntoEditorOptions;
}
export interface IDiffEditorBaseOptions {
@ -3487,6 +3570,10 @@ declare namespace monaco.editor {
* Control the wrapping of the diff editor.
*/
diffWordWrap?: 'off' | 'on' | 'inherit';
/**
* Diff Algorithm
*/
diffAlgorithm?: 'smart' | 'experimental';
}
/**
@ -3794,6 +3881,17 @@ declare namespace monaco.editor {
enabled?: boolean;
}
export interface IEditorStickyScrollOptions {
/**
* Enable the sticky scroll
*/
enabled?: boolean;
/**
* Maximum number of sticky lines to show
*/
maxLineCount?: number;
}
/**
* Configuration options for editor inlayHints
*/
@ -4175,6 +4273,10 @@ declare namespace monaco.editor {
* Show deprecated-suggestions.
*/
showDeprecated?: boolean;
/**
* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning
*/
matchOnWordStartOnly?: boolean;
/**
* Show field-suggestions.
*/
@ -4306,6 +4408,17 @@ declare namespace monaco.editor {
readonly wrappingColumn: number;
}
/**
* Configuration options for editor drop into behavior
*/
export interface IDropIntoEditorOptions {
/**
* Enable the dropping into editor.
* Defaults to true.
*/
enabled?: boolean;
}
export enum EditorOption {
acceptSuggestionOnCommitCharacter = 0,
acceptSuggestionOnEnter = 1,
@ -4339,7 +4452,7 @@ declare namespace monaco.editor {
disableMonospaceOptimizations = 29,
domReadOnly = 30,
dragAndDrop = 31,
enableDropIntoEditor = 32,
dropIntoEditor = 32,
emptySelectionClipboard = 33,
extraEditorClassName = 34,
fastScrollSensitivity = 35,
@ -4412,35 +4525,36 @@ declare namespace monaco.editor {
snippetSuggestions = 102,
smartSelect = 103,
smoothScrolling = 104,
stickyTabStops = 105,
stopRenderingLineAfter = 106,
suggest = 107,
suggestFontSize = 108,
suggestLineHeight = 109,
suggestOnTriggerCharacters = 110,
suggestSelection = 111,
tabCompletion = 112,
tabIndex = 113,
unicodeHighlighting = 114,
unusualLineTerminators = 115,
useShadowDOM = 116,
useTabStops = 117,
wordSeparators = 118,
wordWrap = 119,
wordWrapBreakAfterCharacters = 120,
wordWrapBreakBeforeCharacters = 121,
wordWrapColumn = 122,
wordWrapOverride1 = 123,
wordWrapOverride2 = 124,
wrappingIndent = 125,
wrappingStrategy = 126,
showDeprecated = 127,
inlayHints = 128,
editorClassName = 129,
pixelRatio = 130,
tabFocusMode = 131,
layoutInfo = 132,
wrappingInfo = 133
stickyScroll = 105,
stickyTabStops = 106,
stopRenderingLineAfter = 107,
suggest = 108,
suggestFontSize = 109,
suggestLineHeight = 110,
suggestOnTriggerCharacters = 111,
suggestSelection = 112,
tabCompletion = 113,
tabIndex = 114,
unicodeHighlighting = 115,
unusualLineTerminators = 116,
useShadowDOM = 117,
useTabStops = 118,
wordSeparators = 119,
wordWrap = 120,
wordWrapBreakAfterCharacters = 121,
wordWrapBreakBeforeCharacters = 122,
wordWrapColumn = 123,
wordWrapOverride1 = 124,
wordWrapOverride2 = 125,
wrappingIndent = 126,
wrappingStrategy = 127,
showDeprecated = 128,
inlayHints = 129,
editorClassName = 130,
pixelRatio = 131,
tabFocusMode = 132,
layoutInfo = 133,
wrappingInfo = 134
}
export const EditorOptions: {
@ -4478,7 +4592,8 @@ declare namespace monaco.editor {
domReadOnly: IEditorOption<EditorOption.domReadOnly, boolean>;
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
enableDropIntoEditor: IEditorOption<EditorOption.enableDropIntoEditor, boolean>;
dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
stickyScroll: IEditorOption<EditorOption.stickyScroll, Readonly<Required<IEditorStickyScrollOptions>>>;
extraEditorClassName: IEditorOption<EditorOption.extraEditorClassName, string>;
fastScrollSensitivity: IEditorOption<EditorOption.fastScrollSensitivity, number>;
find: IEditorOption<EditorOption.find, Readonly<Required<IEditorFindOptions>>>;
@ -4984,6 +5099,8 @@ declare namespace monaco.editor {
export interface IMouseTargetOutsideEditor extends IBaseMouseTarget {
readonly type: MouseTargetType.OUTSIDE_EDITOR;
readonly outsidePosition: 'above' | 'below' | 'left' | 'right';
readonly outsideDistance: number;
}
/**
@ -5278,7 +5395,7 @@ declare namespace monaco.editor {
* @id Unique identifier of the contribution.
* @return The action or null if action not found.
*/
getAction(id: string): IEditorAction;
getAction(id: string): IEditorAction | null;
/**
* Execute a command on the editor.
* The edits will land on the undo-redo stack, but no "undo stop" will be pushed.
@ -5335,9 +5452,13 @@ declare namespace monaco.editor {
*/
getVisibleRanges(): Range[];
/**
* Get the vertical position (top offset) for the line w.r.t. to the first line.
* Get the vertical position (top offset) for the line's top w.r.t. to the first line.
*/
getTopForLineNumber(lineNumber: number): number;
/**
* Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.
*/
getBottomForLineNumber(lineNumber: number): number;
/**
* Get the vertical position (top offset) for the position w.r.t. to the first line.
*/
@ -5436,6 +5557,11 @@ declare namespace monaco.editor {
* @event
*/
readonly onDidUpdateDiff: IEvent<void>;
/**
* An event emitted when the diff model is changed (i.e. the diff editor shows new content).
* @event
*/
readonly onDidChangeModel: IEvent<void>;
/**
* Saves current view state of the editor in a serializable object.
*/
@ -5838,6 +5964,10 @@ declare namespace monaco.languages {
* Requested kind of actions to return.
*/
readonly only?: string;
/**
* The reason why code actions were requested.
*/
readonly trigger: CodeActionTriggerType;
}
/**
@ -5868,6 +5998,10 @@ declare namespace monaco.languages {
* such as `["quickfix.removeLine", "source.fixAll" ...]`.
*/
readonly providedCodeActionKinds?: readonly string[];
readonly documentation?: ReadonlyArray<{
readonly kind: string;
readonly command: Command;
}>;
}
/**
@ -6440,6 +6574,11 @@ declare namespace monaco.languages {
disabled?: string;
}
export enum CodeActionTriggerType {
Invoke = 1,
Auto = 2
}
export interface CodeActionList extends IDisposable {
readonly actions: ReadonlyArray<CodeAction>;
}
@ -6776,11 +6915,11 @@ declare namespace monaco.languages {
provideDocumentSymbols(model: editor.ITextModel, token: CancellationToken): ProviderResult<DocumentSymbol[]>;
}
export type TextEdit = {
export interface TextEdit {
range: IRange;
text: string;
eol?: editor.EndOfLineSequence;
};
}
/**
* Interface used to format a model
@ -7018,6 +7157,7 @@ declare namespace monaco.languages {
folder?: boolean;
skipTrashBin?: boolean;
maxSize?: number;
contentsBase64?: string;
}
export interface IWorkspaceFileEdit {