mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Merge branch 'main' into redo-require-removal
This commit is contained in:
commit
30a85dbf36
29 changed files with 6881 additions and 220 deletions
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -48,11 +48,17 @@ jobs:
|
|||
run: npm run compile --prefix webpack-plugin
|
||||
|
||||
- name: Package using webpack plugin
|
||||
run: npm run package-for-smoketest --prefix webpack-plugin
|
||||
run: npm run package-for-smoketest-webpack
|
||||
|
||||
- name: Package using esbuild
|
||||
run: npm run package-for-smoketest-esbuild
|
||||
|
||||
- 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
|
||||
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,3 +2,6 @@
|
|||
**/out/
|
||||
**/release/
|
||||
/test/manual/generated/**
|
||||
/test/smoke/vite/dist/**
|
||||
/test/smoke/parcel/dist/**
|
||||
/test/smoke/parcel/.cache/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
# 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
|
||||
|
||||
## [0.34.0]
|
||||
|
||||
- Introduction of `IEditor.createDecorationsCollection` API
|
||||
|
|
|
|||
6261
package-lock.json
generated
6261
package-lock.json
generated
File diff suppressed because it is too large
Load diff
23
package.json
23
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "monaco-editor",
|
||||
"version": "0.34.0",
|
||||
"vscode": "4b8a47f3570a4a05ace9d00ae0df044b55befcd5",
|
||||
"version": "0.34.1",
|
||||
"vscode": "0316a754aa4c25208bef91937efbce2ab1e3ce37",
|
||||
"private": true,
|
||||
"description": "A browser based code editor",
|
||||
"author": "Microsoft Corporation",
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
"scripts": {
|
||||
"build-website": "ts-node ./build/website && npm run typedoc",
|
||||
"import-typescript": "ts-node ./build/importTypescript",
|
||||
"package-for-smoketest-esbuild": "ts-node ./test/smoke/package-esbuild",
|
||||
"playwright-install": "node ./node_modules/playwright/install.js",
|
||||
"playwright-install-deps": "playwright install-deps",
|
||||
"postinstall": "ts-node ./build/postinstall",
|
||||
|
|
@ -18,8 +17,12 @@
|
|||
"pretty-quick": "pretty-quick --staged",
|
||||
"release": "ts-node ./build/build && ts-node ./build/release",
|
||||
"simpleserver": "ts-node ./build/simpleserver",
|
||||
"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
|
||||
"package-for-smoketest-webpack": "ts-node ./test/smoke/package-webpack",
|
||||
"package-for-smoketest-webpack-cross-origin": "ts-node ./test/smoke/package-webpack --cross-origin",
|
||||
"package-for-smoketest-esbuild": "ts-node ./test/smoke/package-esbuild",
|
||||
"package-for-smoketest-vite": "ts-node ./test/smoke/package-vite",
|
||||
"smoketest": "node ./test/smoke/runner.js",
|
||||
"smoketest-debug": "node ./test/smoke/runner.js --debug-tests",
|
||||
"test": "mocha test/unit/all.js",
|
||||
"deps-all-remove": "ts-node ./build/npm/removeAll",
|
||||
"deps-all-install": "ts-node ./build/npm/installAll",
|
||||
|
|
@ -37,28 +40,38 @@
|
|||
"@typescript/vfs": "^1.3.5",
|
||||
"chai": "^4.3.6",
|
||||
"clean-css": "^5.2.4",
|
||||
"css-loader": "^6.7.1",
|
||||
"esbuild": "^0.14.49",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"file-loader": "^6.2.0",
|
||||
"glob": "^7.2.0",
|
||||
"husky": "^7.0.4",
|
||||
"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",
|
||||
"requirejs": "^2.3.6",
|
||||
"style-loader": "^3.3.1",
|
||||
"terser": "^5.14.2",
|
||||
"ts-node": "^10.6.0",
|
||||
"typedoc": "^0.22.11",
|
||||
"typescript": "4.5.5",
|
||||
"vite": "^3.1.8",
|
||||
"vscode-css-languageservice": "5.4.1",
|
||||
"vscode-html-languageservice": "4.2.4",
|
||||
"vscode-json-languageservice": "4.2.1",
|
||||
"vscode-languageserver-textdocument": "^1.0.4",
|
||||
"vscode-languageserver-types": "3.16.0",
|
||||
"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) {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
|
||||
<script src="../../release/dev/vs/loader.js"></script>
|
||||
<script src="../../../release/dev/vs/loader.js"></script>
|
||||
<script>
|
||||
require.config({
|
||||
paths: {
|
||||
vs: '../../release/dev/vs'
|
||||
vs: '../../../release/dev/vs'
|
||||
}
|
||||
});
|
||||
require(['vs/editor/editor.main'], () => {
|
||||
|
|
@ -3,4 +3,9 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
exports.PORT = 8563;
|
||||
/* keeping TS happy */
|
||||
exports.__nothing = undefined;
|
||||
|
||||
/** @typedef {'chromium'|'firefox'|'webkit'} BrowserKind */
|
||||
/** @typedef {'amd'|'webpack'|'esbuild'|'vite'|'parcel'} PackagerKind */
|
||||
/** @typedef {{browser:BrowserKind; packager:PackagerKind; debugTests:boolean; port:number;}} TestInfo */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as monaco from '../../../release/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import * as esbuild from 'esbuild';
|
|||
import * as path from 'path';
|
||||
import { removeDir } from '../../build/fs';
|
||||
|
||||
removeDir('test/smoke/esbuild/out', (entry) => /esbuild.html$/.test(entry));
|
||||
removeDir('test/smoke/esbuild/out');
|
||||
|
||||
const workerEntryPoints = [
|
||||
'vs/language/json/json.worker.js',
|
||||
|
|
|
|||
19
test/smoke/package-vite.ts
Normal file
19
test/smoke/package-vite.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vite from 'vite';
|
||||
import * as path from 'path';
|
||||
|
||||
async function main() {
|
||||
await vite.build({
|
||||
root: path.resolve(__dirname, './vite/'),
|
||||
base: '/test/smoke/vite/dist/',
|
||||
build: {
|
||||
minify: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
56
test/smoke/package-webpack.ts
Normal file
56
test/smoke/package-webpack.ts
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import webpack from 'webpack';
|
||||
import MonacoWebpackPlugin from '../../webpack-plugin/out/index.js';
|
||||
import * as path from 'path';
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
const CROSS_ORIGIN_ASSETS = process.argv.includes('--cross-origin');
|
||||
|
||||
webpack(
|
||||
{
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: path.join(__dirname, 'webpack'),
|
||||
output: {
|
||||
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
|
||||
filename: 'app.js',
|
||||
publicPath: CROSS_ORIGIN_ASSETS
|
||||
? 'http://localhost:8088/monaco-editor/test/smoke/webpack/out/'
|
||||
: undefined
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'monaco-editor': path.resolve(REPO_ROOT, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [<any>new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})]
|
||||
},
|
||||
(err: Error | undefined, stats: webpack.Stats | undefined) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
if (stats && stats.hasErrors()) {
|
||||
console.log(stats.compilation.errors);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
);
|
||||
11
test/smoke/parcel/index.html
Normal file
11
test/smoke/parcel/index.html
Normal file
|
|
@ -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>
|
||||
35
test/smoke/parcel/index.js
Normal file
35
test/smoke/parcel/index.js
Normal file
|
|
@ -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;
|
||||
6
test/smoke/parcel/package.json
Normal file
6
test/smoke/parcel/package.json
Normal file
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
@ -9,10 +9,14 @@ const yaserver = require('yaserver');
|
|||
const http = require('http');
|
||||
const cp = require('child_process');
|
||||
const path = require('path');
|
||||
const { PORT } = require('./common');
|
||||
const DEBUG_TESTS = process.argv.includes('--debug-tests');
|
||||
|
||||
/** @typedef {import('./common').BrowserKind} BrowserKind */
|
||||
/** @typedef {import('./common').PackagerKind} PackagerKind */
|
||||
/** @typedef {import('./common').TestInfo} TestInfo */
|
||||
|
||||
const DEBUG_TESTS = process.argv.includes('--debug-tests');
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
const PORT = 8563;
|
||||
|
||||
yaserver
|
||||
.createServer({
|
||||
|
|
@ -37,25 +41,31 @@ yaserver
|
|||
async function runTests() {
|
||||
// uncomment to shortcircuit and run a specific combo
|
||||
// await runTest('webpack', 'chromium'); return;
|
||||
/** @type {PackagerKind[]} */
|
||||
const testTypes = ['amd', 'webpack', 'esbuild', 'vite', 'parcel'];
|
||||
|
||||
for (const type of ['amd', 'webpack' /*, 'esbuild'*/]) {
|
||||
for (const type of testTypes) {
|
||||
await runTest(type, 'chromium');
|
||||
await runTest(type, 'firefox');
|
||||
// await runTest(type, 'webkit');
|
||||
await runTest(type, 'webkit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {'chromium'|'firefox'|'webkit'} browser
|
||||
* @param {PackagerKind} packager
|
||||
* @param {BrowserKind} browser
|
||||
* @returns
|
||||
*/
|
||||
function runTest(type, browser) {
|
||||
function runTest(packager, browser) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const env = { BROWSER: browser, TESTS_TYPE: type, ...process.env };
|
||||
if (DEBUG_TESTS) {
|
||||
env['DEBUG_TESTS'] = 'true';
|
||||
}
|
||||
/** @type TestInfo */
|
||||
const testInfo = {
|
||||
browser,
|
||||
packager,
|
||||
debugTests: DEBUG_TESTS,
|
||||
port: PORT
|
||||
};
|
||||
const env = { MONACO_TEST_INFO: JSON.stringify(testInfo), ...process.env };
|
||||
const proc = cp.spawn(
|
||||
'node',
|
||||
[
|
||||
|
|
@ -74,7 +84,7 @@ function runTest(type, browser) {
|
|||
proc.on('error', reject);
|
||||
proc.on('exit', (code) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
resolve(undefined);
|
||||
} else {
|
||||
reject(code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,20 +7,24 @@
|
|||
|
||||
const playwright = require('playwright');
|
||||
const { assert } = require('chai');
|
||||
const { PORT } = require('./common');
|
||||
|
||||
const browserType = process.env.BROWSER || 'chromium';
|
||||
const DEBUG_TESTS = Boolean(process.env.DEBUG_TESTS || false);
|
||||
const TESTS_TYPE = process.env.TESTS_TYPE || 'amd';
|
||||
/** @typedef {import('./common').BrowserKind} BrowserKind */
|
||||
/** @typedef {import('./common').PackagerKind} PackagerKind */
|
||||
/** @typedef {import('./common').TestInfo} TestInfo */
|
||||
|
||||
const URL =
|
||||
TESTS_TYPE === 'amd'
|
||||
? `http://127.0.0.1:${PORT}/test/smoke/amd.html`
|
||||
: TESTS_TYPE === 'webpack'
|
||||
? `http://127.0.0.1:${PORT}/test/smoke/webpack/webpack.html`
|
||||
: `http://127.0.0.1:${PORT}/test/smoke/esbuild/esbuild.html`;
|
||||
/** @type TestInfo */
|
||||
const testInfo = JSON.parse(process.env.MONACO_TEST_INFO || '');
|
||||
|
||||
suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
||||
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`,
|
||||
parcel: `http://127.0.0.1:${testInfo.port}/test/smoke/parcel/dist/index.html`
|
||||
};
|
||||
const URL = URLS[testInfo.packager];
|
||||
|
||||
suite(`Smoke Test '${testInfo.packager}' on '${testInfo.browser}'`, () => {
|
||||
/** @type {playwright.Browser} */
|
||||
let browser;
|
||||
|
||||
|
|
@ -28,10 +32,10 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
let page;
|
||||
|
||||
suiteSetup(async () => {
|
||||
browser = await playwright[browserType].launch({
|
||||
headless: !DEBUG_TESTS,
|
||||
devtools: DEBUG_TESTS && browserType === 'chromium'
|
||||
// slowMo: DEBUG_TESTS ? 2000 : 0
|
||||
browser = await playwright[testInfo.browser].launch({
|
||||
headless: !testInfo.debugTests,
|
||||
devtools: testInfo.debugTests && testInfo.browser === 'chromium'
|
||||
// slowMo: testInfo.debugTests ? 2000 : 0
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -104,11 +108,11 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
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
|
||||
|
|
@ -119,14 +123,14 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
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
|
||||
|
|
@ -148,7 +152,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
}
|
||||
});
|
||||
|
||||
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
|
||||
|
|
@ -165,7 +169,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
}
|
||||
});
|
||||
|
||||
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
|
||||
|
|
@ -184,7 +188,7 @@ suite(`Smoke Test '${TESTS_TYPE}' on '${browserType}'`, () => {
|
|||
// find the TypeScript worker
|
||||
const tsWorker = page.workers().find((worker) => {
|
||||
const url = worker.url();
|
||||
return /ts\.worker\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
|
||||
return /ts\.worker(\.[a-f0-9]+)?\.js$/.test(url) || /workerMain.js#typescript$/.test(url);
|
||||
});
|
||||
if (!tsWorker) {
|
||||
assert.fail('Could not find TypeScript worker');
|
||||
|
|
|
|||
10
test/smoke/vite/index.html
Normal file
10
test/smoke/vite/index.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
|
||||
<script type="module" src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
31
test/smoke/vite/index.js
Normal file
31
test/smoke/vite/index.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as monaco from '../../../release/esm/vs/editor/editor.main';
|
||||
import editorWorker from '../../../release/esm/vs/editor/editor.worker?worker';
|
||||
import jsonWorker from '../../../release/esm/vs/language/json/json.worker?worker';
|
||||
import cssWorker from '../../../release/esm/vs/language/css/css.worker?worker';
|
||||
import htmlWorker from '../../../release/esm/vs/language/html/html.worker?worker';
|
||||
import tsWorker from '../../../release/esm/vs/language/typescript/ts.worker?worker';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorker(moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return new jsonWorker();
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return new cssWorker();
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return new htmlWorker();
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return new tsWorker();
|
||||
}
|
||||
return new editorWorker();
|
||||
}
|
||||
};
|
||||
|
||||
window.monacoAPI = monaco;
|
||||
|
|
@ -58,5 +58,6 @@ requirejs(
|
|||
},
|
||||
function (err) {
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ define('vs/nls', [], {
|
|||
return {
|
||||
localize: function () {
|
||||
return 'NO_LOCALIZATION_FOR_YOU';
|
||||
},
|
||||
getConfiguredDefaultLocale: function () {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
"main": "out/index.js",
|
||||
"typings": "./out/index.d.ts",
|
||||
"scripts": {
|
||||
"package-for-smoketest": "node ./node_modules/webpack/bin/webpack.js --config smoketest/webpack.config.js --progress",
|
||||
"smoketest-cross-origin": "node ./node_modules/webpack/bin/webpack.js --config smoketest/webpack-cross-origin.config.js --progress",
|
||||
"watch": "tsc -w -p tsconfig.json",
|
||||
"compile": "tsc -p tsconfig.json",
|
||||
"import-editor": "node ./scripts/import-editor.js",
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
const ASSET_PATH = 'http://localhost:8088/monaco-editor/test/smoke/webpack/out/';
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
|
||||
filename: 'app.js',
|
||||
publicPath: ASSET_PATH
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'monaco-editor': path.resolve(REPO_ROOT, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
const MonacoWebpackPlugin = require('../out/index.js');
|
||||
const path = require('path');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: './index.js',
|
||||
context: __dirname,
|
||||
output: {
|
||||
path: path.resolve(REPO_ROOT, 'test/smoke/webpack/out'),
|
||||
filename: 'app.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'monaco-editor': path.resolve(REPO_ROOT, 'release')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader']
|
||||
},
|
||||
{
|
||||
test: /\.ttf$/,
|
||||
use: ['file-loader']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MonacoWebpackPlugin({
|
||||
monacoEditorPath: path.resolve(REPO_ROOT, 'release')
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
@ -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
vendored
222
website/typedoc/monaco.d.ts
vendored
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue