mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Merge pull request #2935 from microsoft/hediet/monaco-editor-core-filler-improvement
Don't load editor api from global API but use require directly.
This commit is contained in:
commit
8b3ac48ea1
39 changed files with 116 additions and 105 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
/samples/browser-esm-webpack-small/dist/*.js
|
/samples/browser-esm-webpack-small/dist/*.js
|
||||||
/samples/browser-esm-webpack-typescript/dist/*.js
|
/samples/browser-esm-webpack-typescript/dist/*.js
|
||||||
/samples/browser-esm-webpack-typescript-react/dist/*.js
|
/samples/browser-esm-webpack-typescript-react/dist/*.js
|
||||||
/src/typescript/lib/
|
/src/language/typescript/lib/
|
||||||
/test/manual/generated/
|
/test/manual/generated/
|
||||||
/website/lib/
|
/website/lib/
|
||||||
/website/typedoc/monaco.d.ts
|
/website/typedoc/monaco.d.ts
|
||||||
|
|
|
||||||
122
build/build.js
122
build/build.js
|
|
@ -15,20 +15,24 @@ tsc(`src/tsconfig.json`);
|
||||||
|
|
||||||
//#region Type Defintion
|
//#region Type Defintion
|
||||||
|
|
||||||
dts(`out/amd/css/monaco.contribution.d.ts`, `out/release/css/monaco.d.ts`, 'monaco.languages.css');
|
|
||||||
dts(
|
dts(
|
||||||
`out/amd/html/monaco.contribution.d.ts`,
|
`out/amd/language/css/monaco.contribution.d.ts`,
|
||||||
`out/release/html/monaco.d.ts`,
|
`out/release/language/css/monaco.d.ts`,
|
||||||
|
'monaco.languages.css'
|
||||||
|
);
|
||||||
|
dts(
|
||||||
|
`out/amd/language/html/monaco.contribution.d.ts`,
|
||||||
|
`out/release/language/html/monaco.d.ts`,
|
||||||
'monaco.languages.html'
|
'monaco.languages.html'
|
||||||
);
|
);
|
||||||
dts(
|
dts(
|
||||||
`out/amd/json/monaco.contribution.d.ts`,
|
`out/amd/language/json/monaco.contribution.d.ts`,
|
||||||
`out/release/json/monaco.d.ts`,
|
`out/release/language/json/monaco.d.ts`,
|
||||||
'monaco.languages.json'
|
'monaco.languages.json'
|
||||||
);
|
);
|
||||||
dts(
|
dts(
|
||||||
`out/amd/typescript/monaco.contribution.d.ts`,
|
`out/amd/language/typescript/monaco.contribution.d.ts`,
|
||||||
`out/release/typescript/monaco.d.ts`,
|
`out/release/language/typescript/monaco.d.ts`,
|
||||||
'monaco.languages.typescript'
|
'monaco.languages.typescript'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -37,24 +41,29 @@ dts(
|
||||||
//#region css
|
//#region css
|
||||||
|
|
||||||
buildESM({
|
buildESM({
|
||||||
base: 'css',
|
base: 'language/css',
|
||||||
entryPoints: ['src/css/monaco.contribution.ts', 'src/css/cssMode.ts', 'src/css/css.worker.ts'],
|
entryPoints: [
|
||||||
external: ['monaco-editor-core', '*/cssMode']
|
'src/language/css/monaco.contribution.ts',
|
||||||
|
'src/language/css/cssMode.ts',
|
||||||
|
'src/language/css/css.worker.ts'
|
||||||
|
],
|
||||||
|
external: ['monaco-editor-core', '*/cssMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'css',
|
base: 'language/css',
|
||||||
entryPoint: 'src/css/monaco.contribution.ts',
|
entryPoint: 'src/language/css/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/css/monaco.contribution',
|
amdModuleId: 'vs/language/css/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'css',
|
base: 'language/css',
|
||||||
entryPoint: 'src/css/cssMode.ts',
|
entryPoint: 'src/language/css/cssMode.ts',
|
||||||
amdModuleId: 'vs/language/css/cssMode'
|
amdModuleId: 'vs/language/css/cssMode',
|
||||||
|
external: ['*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'css',
|
base: 'language/css',
|
||||||
entryPoint: 'src/css/cssWorker.ts',
|
entryPoint: 'src/language/css/cssWorker.ts',
|
||||||
amdModuleId: 'vs/language/css/cssWorker'
|
amdModuleId: 'vs/language/css/cssWorker'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -63,28 +72,29 @@ buildAMD({
|
||||||
//#region html
|
//#region html
|
||||||
|
|
||||||
buildESM({
|
buildESM({
|
||||||
base: 'html',
|
base: 'language/html',
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
'src/html/monaco.contribution.ts',
|
'src/language/html/monaco.contribution.ts',
|
||||||
'src/html/htmlMode.ts',
|
'src/language/html/htmlMode.ts',
|
||||||
'src/html/html.worker.ts'
|
'src/language/html/html.worker.ts'
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/htmlMode']
|
external: ['monaco-editor-core', '*/htmlMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'html',
|
base: 'language/html',
|
||||||
entryPoint: 'src/html/monaco.contribution.ts',
|
entryPoint: 'src/language/html/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/html/monaco.contribution',
|
amdModuleId: 'vs/language/html/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'html',
|
base: 'language/html',
|
||||||
entryPoint: 'src/html/htmlMode.ts',
|
entryPoint: 'src/language/html/htmlMode.ts',
|
||||||
amdModuleId: 'vs/language/html/htmlMode'
|
amdModuleId: 'vs/language/html/htmlMode',
|
||||||
|
external: ['*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'html',
|
base: 'language/html',
|
||||||
entryPoint: 'src/html/htmlWorker.ts',
|
entryPoint: 'src/language/html/htmlWorker.ts',
|
||||||
amdModuleId: 'vs/language/html/htmlWorker'
|
amdModuleId: 'vs/language/html/htmlWorker'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -93,28 +103,29 @@ buildAMD({
|
||||||
//#region json
|
//#region json
|
||||||
|
|
||||||
buildESM({
|
buildESM({
|
||||||
base: 'json',
|
base: 'language/json',
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
'src/json/monaco.contribution.ts',
|
'src/language/json/monaco.contribution.ts',
|
||||||
'src/json/jsonMode.ts',
|
'src/language/json/jsonMode.ts',
|
||||||
'src/json/json.worker.ts'
|
'src/language/json/json.worker.ts'
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/jsonMode']
|
external: ['monaco-editor-core', '*/jsonMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'json',
|
base: 'language/json',
|
||||||
entryPoint: 'src/json/monaco.contribution.ts',
|
entryPoint: 'src/language/json/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/json/monaco.contribution',
|
amdModuleId: 'vs/language/json/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'json',
|
base: 'language/json',
|
||||||
entryPoint: 'src/json/jsonMode.ts',
|
entryPoint: 'src/language/json/jsonMode.ts',
|
||||||
amdModuleId: 'vs/language/json/jsonMode'
|
amdModuleId: 'vs/language/json/jsonMode',
|
||||||
|
external: ['*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'json',
|
base: 'language/json',
|
||||||
entryPoint: 'src/json/jsonWorker.ts',
|
entryPoint: 'src/language/json/jsonWorker.ts',
|
||||||
amdModuleId: 'vs/language/json/jsonWorker'
|
amdModuleId: 'vs/language/json/jsonWorker'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -123,33 +134,34 @@ buildAMD({
|
||||||
//#region typescript
|
//#region typescript
|
||||||
|
|
||||||
copyFile(
|
copyFile(
|
||||||
`src/typescript/lib/typescriptServices-amd.js`,
|
`src/language/typescript/lib/typescriptServices-amd.js`,
|
||||||
`out/amd/typescript/lib/typescriptServices.js`
|
`out/amd/language/typescript/lib/typescriptServices.js`
|
||||||
);
|
);
|
||||||
|
|
||||||
buildESM({
|
buildESM({
|
||||||
base: 'typescript',
|
base: 'language/typescript',
|
||||||
entryPoints: [
|
entryPoints: [
|
||||||
'src/typescript/monaco.contribution.ts',
|
'src/language/typescript/monaco.contribution.ts',
|
||||||
'src/typescript/tsMode.ts',
|
'src/language/typescript/tsMode.ts',
|
||||||
'src/typescript/ts.worker.ts'
|
'src/language/typescript/ts.worker.ts'
|
||||||
],
|
],
|
||||||
external: ['monaco-editor-core', '*/tsMode']
|
external: ['monaco-editor-core', '*/tsMode', '*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'typescript',
|
base: 'language/typescript',
|
||||||
entryPoint: 'src/typescript/monaco.contribution.ts',
|
entryPoint: 'src/language/typescript/monaco.contribution.ts',
|
||||||
amdModuleId: 'vs/language/typescript/monaco.contribution',
|
amdModuleId: 'vs/language/typescript/monaco.contribution',
|
||||||
amdDependencies: ['vs/editor/editor.api']
|
amdDependencies: ['vs/editor/editor.api']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'typescript',
|
base: 'language/typescript',
|
||||||
entryPoint: 'src/typescript/tsMode.ts',
|
entryPoint: 'src/language/typescript/tsMode.ts',
|
||||||
amdModuleId: 'vs/language/typescript/tsMode'
|
amdModuleId: 'vs/language/typescript/tsMode',
|
||||||
|
external: ['*/monaco.contribution']
|
||||||
});
|
});
|
||||||
buildAMD({
|
buildAMD({
|
||||||
base: 'typescript',
|
base: 'language/typescript',
|
||||||
entryPoint: 'src/typescript/tsWorker.ts',
|
entryPoint: 'src/language/typescript/tsWorker.ts',
|
||||||
amdModuleId: 'vs/language/typescript/tsWorker'
|
amdModuleId: 'vs/language/typescript/tsWorker'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// Resolves with the global monaco API
|
|
||||||
|
|
||||||
export = (<any>self).monaco;
|
|
||||||
|
|
@ -16,7 +16,7 @@ const generatedNote = `//
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const TYPESCRIPT_LIB_SOURCE = path.join(REPO_ROOT, 'node_modules/typescript/lib');
|
const TYPESCRIPT_LIB_SOURCE = path.join(REPO_ROOT, 'node_modules/typescript/lib');
|
||||||
const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'src/typescript/lib');
|
const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'src/language/typescript/lib');
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -155,9 +155,15 @@ exports.buildESM = buildESM;
|
||||||
* entryPoint: string;
|
* entryPoint: string;
|
||||||
* amdModuleId: string;
|
* amdModuleId: string;
|
||||||
* amdDependencies?: string[];
|
* amdDependencies?: string[];
|
||||||
|
* external?: string[];
|
||||||
* }} options
|
* }} options
|
||||||
*/
|
*/
|
||||||
function buildOneAMD(type, options) {
|
function buildOneAMD(type, options) {
|
||||||
|
if (!options.amdDependencies) {
|
||||||
|
options.amdDependencies = [];
|
||||||
|
}
|
||||||
|
options.amdDependencies.unshift('require');
|
||||||
|
|
||||||
/** @type {import('esbuild').BuildOptions} */
|
/** @type {import('esbuild').BuildOptions} */
|
||||||
const opts = {
|
const opts = {
|
||||||
entryPoints: [options.entryPoint],
|
entryPoints: [options.entryPoint],
|
||||||
|
|
@ -171,7 +177,7 @@ function buildOneAMD(type, options) {
|
||||||
banner: {
|
banner: {
|
||||||
js: `${bundledFileHeader}define("${options.amdModuleId}", [${(options.amdDependencies || [])
|
js: `${bundledFileHeader}define("${options.amdModuleId}", [${(options.amdDependencies || [])
|
||||||
.map((dep) => `"${dep}"`)
|
.map((dep) => `"${dep}"`)
|
||||||
.join(',')}],()=>{`
|
.join(',')}],(require)=>{`
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
js: 'return moduleExports;\n});'
|
js: 'return moduleExports;\n});'
|
||||||
|
|
@ -181,9 +187,10 @@ function buildOneAMD(type, options) {
|
||||||
plugins: [
|
plugins: [
|
||||||
alias({
|
alias({
|
||||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||||
'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts')
|
'monaco-editor-core': path.join(__dirname, '../src/fillers/monaco-editor-core-amd.ts')
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
external: ['vs/editor/editor.api', ...(options.external || [])]
|
||||||
};
|
};
|
||||||
if (type === 'min') {
|
if (type === 'min') {
|
||||||
opts.minify = true;
|
opts.minify = true;
|
||||||
|
|
@ -197,6 +204,7 @@ function buildOneAMD(type, options) {
|
||||||
* entryPoint: string;
|
* entryPoint: string;
|
||||||
* amdModuleId: string;
|
* amdModuleId: string;
|
||||||
* amdDependencies?: string[];
|
* amdDependencies?: string[];
|
||||||
|
* external?: string[];
|
||||||
* }} options
|
* }} options
|
||||||
*/
|
*/
|
||||||
function buildAMD(options) {
|
function buildAMD(options) {
|
||||||
|
|
|
||||||
16
metadata.js
16
metadata.js
|
|
@ -15,10 +15,10 @@
|
||||||
name: 'monaco-typescript',
|
name: 'monaco-typescript',
|
||||||
contrib: 'vs/language/typescript/monaco.contribution',
|
contrib: 'vs/language/typescript/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/typescript',
|
modulePrefix: 'vs/language/typescript',
|
||||||
rootPath: './out/release/typescript',
|
rootPath: './out/release/language/typescript',
|
||||||
paths: {
|
paths: {
|
||||||
// use ./ to indicate it is relative to the `rootPath`
|
// use ./ to indicate it is relative to the `rootPath`
|
||||||
src: './../../amd/typescript',
|
src: './../../../amd/language/typescript',
|
||||||
dev: './dev',
|
dev: './dev',
|
||||||
min: './min',
|
min: './min',
|
||||||
esm: './esm'
|
esm: './esm'
|
||||||
|
|
@ -28,10 +28,10 @@
|
||||||
name: 'monaco-css',
|
name: 'monaco-css',
|
||||||
contrib: 'vs/language/css/monaco.contribution',
|
contrib: 'vs/language/css/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/css',
|
modulePrefix: 'vs/language/css',
|
||||||
rootPath: './out/release/css',
|
rootPath: './out/release/language/css',
|
||||||
paths: {
|
paths: {
|
||||||
// use ./ to indicate it is relative to the `rootPath`
|
// use ./ to indicate it is relative to the `rootPath`
|
||||||
src: './../../amd/css',
|
src: './../../../amd/language/css',
|
||||||
dev: './dev',
|
dev: './dev',
|
||||||
min: './min',
|
min: './min',
|
||||||
esm: './esm'
|
esm: './esm'
|
||||||
|
|
@ -41,10 +41,10 @@
|
||||||
name: 'monaco-json',
|
name: 'monaco-json',
|
||||||
contrib: 'vs/language/json/monaco.contribution',
|
contrib: 'vs/language/json/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/json',
|
modulePrefix: 'vs/language/json',
|
||||||
rootPath: './out/release/json',
|
rootPath: './out/release/language/json',
|
||||||
paths: {
|
paths: {
|
||||||
// use ./ to indicate it is relative to the `rootPath`
|
// use ./ to indicate it is relative to the `rootPath`
|
||||||
src: './../../amd/json',
|
src: './../../../amd/language/json',
|
||||||
dev: './dev',
|
dev: './dev',
|
||||||
min: './min',
|
min: './min',
|
||||||
esm: './esm'
|
esm: './esm'
|
||||||
|
|
@ -54,10 +54,10 @@
|
||||||
name: 'monaco-html',
|
name: 'monaco-html',
|
||||||
contrib: 'vs/language/html/monaco.contribution',
|
contrib: 'vs/language/html/monaco.contribution',
|
||||||
modulePrefix: 'vs/language/html',
|
modulePrefix: 'vs/language/html',
|
||||||
rootPath: './out/release/html',
|
rootPath: './out/release/language/html',
|
||||||
paths: {
|
paths: {
|
||||||
// use ./ to indicate it is relative to the `rootPath`
|
// use ./ to indicate it is relative to the `rootPath`
|
||||||
src: './../../amd/html',
|
src: './../../../amd/language/html',
|
||||||
dev: './dev',
|
dev: './dev',
|
||||||
min: './min',
|
min: './min',
|
||||||
esm: './esm'
|
esm: './esm'
|
||||||
|
|
|
||||||
4
src/fillers/editor.api.d.ts
vendored
Normal file
4
src/fillers/editor.api.d.ts
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
declare module 'vs/editor/editor.api' {
|
||||||
|
const x: any;
|
||||||
|
export = x;
|
||||||
|
}
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
|
|
||||||
// Resolves with the global monaco API
|
// Resolves with the global monaco API
|
||||||
|
|
||||||
declare var define: any;
|
/// <reference path="./editor.api.d.ts" />
|
||||||
|
import * as api from 'vs/editor/editor.api';
|
||||||
|
|
||||||
define([], function () {
|
export = api;
|
||||||
return (<any>self).monaco;
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
IDisposable,
|
IDisposable,
|
||||||
MarkerSeverity,
|
MarkerSeverity,
|
||||||
IEvent
|
IEvent
|
||||||
} from '../fillers/monaco-editor-core';
|
} from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export interface WorkerAccessor<T> {
|
export interface WorkerAccessor<T> {
|
||||||
(...more: Uri[]): Promise<T>;
|
(...more: Uri[]): Promise<T>;
|
||||||
|
|
@ -7,7 +7,7 @@ import { WorkerManager } from './workerManager';
|
||||||
import type { CSSWorker } from './cssWorker';
|
import type { CSSWorker } from './cssWorker';
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import * as languageFeatures from '../common/lspLanguageFeatures';
|
import * as languageFeatures from '../common/lspLanguageFeatures';
|
||||||
import { Uri, IDisposable, languages } from '../fillers/monaco-editor-core';
|
import { Uri, IDisposable, languages } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
export function setupMode(defaults: LanguageServiceDefaults): IDisposable {
|
||||||
const disposables: IDisposable[] = [];
|
const disposables: IDisposable[] = [];
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import type { worker } from '../fillers/monaco-editor-core';
|
import type { worker } from '../../fillers/monaco-editor-core';
|
||||||
import * as cssService from 'vscode-css-languageservice';
|
import * as cssService from 'vscode-css-languageservice';
|
||||||
import { Options } from './monaco.contribution';
|
import { Options } from './monaco.contribution';
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as mode from './cssMode';
|
import * as mode from './cssMode';
|
||||||
import { languages, Emitter, IEvent } from '../fillers/monaco-editor-core';
|
import { languages, Emitter, IEvent } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export interface Options {
|
export interface Options {
|
||||||
readonly validate?: boolean;
|
readonly validate?: boolean;
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { CSSWorker } from './cssWorker';
|
import type { CSSWorker } from './cssWorker';
|
||||||
import { editor, IDisposable, Uri } from '../fillers/monaco-editor-core';
|
import { editor, IDisposable, Uri } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@ import { WorkerManager } from './workerManager';
|
||||||
import type { HTMLWorker } from './htmlWorker';
|
import type { HTMLWorker } from './htmlWorker';
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import * as languageFeatures from '../common/lspLanguageFeatures';
|
import * as languageFeatures from '../common/lspLanguageFeatures';
|
||||||
import { Uri, IDisposable, languages } from '../fillers/monaco-editor-core';
|
import { Uri, IDisposable, languages } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
class HTMLCompletionAdapter extends languageFeatures.CompletionAdapter<HTMLWorker> {
|
class HTMLCompletionAdapter extends languageFeatures.CompletionAdapter<HTMLWorker> {
|
||||||
constructor(worker: languageFeatures.WorkerAccessor<HTMLWorker>) {
|
constructor(worker: languageFeatures.WorkerAccessor<HTMLWorker>) {
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { worker } from '../fillers/monaco-editor-core';
|
import { worker } from '../../fillers/monaco-editor-core';
|
||||||
import * as htmlService from 'vscode-html-languageservice';
|
import * as htmlService from 'vscode-html-languageservice';
|
||||||
import type { Options } from './monaco.contribution';
|
import type { Options } from './monaco.contribution';
|
||||||
import { IHTMLDataProvider } from 'vscode-html-languageservice';
|
import { IHTMLDataProvider } from 'vscode-html-languageservice';
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as mode from './htmlMode';
|
import * as mode from './htmlMode';
|
||||||
import { languages, Emitter, IEvent, IDisposable } from '../fillers/monaco-editor-core';
|
import { languages, Emitter, IEvent, IDisposable } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export interface HTMLFormatConfiguration {
|
export interface HTMLFormatConfiguration {
|
||||||
readonly tabSize: number;
|
readonly tabSize: number;
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { HTMLWorker } from './htmlWorker';
|
import type { HTMLWorker } from './htmlWorker';
|
||||||
import { Uri, IDisposable, editor } from '../fillers/monaco-editor-core';
|
import { Uri, IDisposable, editor } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ import type { JSONWorker } from './jsonWorker';
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import * as languageFeatures from '../common/lspLanguageFeatures';
|
import * as languageFeatures from '../common/lspLanguageFeatures';
|
||||||
import { createTokenizationSupport } from './tokenization';
|
import { createTokenizationSupport } from './tokenization';
|
||||||
import { Uri, IDisposable, languages, editor } from '../fillers/monaco-editor-core';
|
import { Uri, IDisposable, languages, editor } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
class JSONDiagnosticsAdapter extends languageFeatures.DiagnosticsAdapter<JSONWorker> {
|
class JSONDiagnosticsAdapter extends languageFeatures.DiagnosticsAdapter<JSONWorker> {
|
||||||
constructor(
|
constructor(
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as jsonService from 'vscode-json-languageservice';
|
import * as jsonService from 'vscode-json-languageservice';
|
||||||
import type { worker } from '../fillers/monaco-editor-core';
|
import type { worker } from '../../fillers/monaco-editor-core';
|
||||||
import { URI } from 'vscode-uri';
|
import { URI } from 'vscode-uri';
|
||||||
import { DiagnosticsOptions } from './monaco.contribution';
|
import { DiagnosticsOptions } from './monaco.contribution';
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as mode from './jsonMode';
|
import * as mode from './jsonMode';
|
||||||
import { Emitter, IEvent, languages } from '../fillers/monaco-editor-core';
|
import { Emitter, IEvent, languages } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
// --- JSON configuration and defaults ---------
|
// --- JSON configuration and defaults ---------
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import * as json from 'jsonc-parser';
|
import * as json from 'jsonc-parser';
|
||||||
import { languages } from '../fillers/monaco-editor-core';
|
import { languages } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export function createTokenizationSupport(supportComments: boolean): languages.TokensProvider {
|
export function createTokenizationSupport(supportComments: boolean): languages.TokensProvider {
|
||||||
return {
|
return {
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { JSONWorker } from './jsonWorker';
|
import type { JSONWorker } from './jsonWorker';
|
||||||
import { IDisposable, Uri, editor } from '../fillers/monaco-editor-core';
|
import { IDisposable, Uri, editor } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
const STOP_WHEN_IDLE_FOR = 2 * 60 * 1000; // 2min
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
IRange,
|
IRange,
|
||||||
MarkerTag,
|
MarkerTag,
|
||||||
MarkerSeverity
|
MarkerSeverity
|
||||||
} from '../fillers/monaco-editor-core';
|
} from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
//#region utils copied from typescript to prevent loading the entire typescriptServices ---
|
//#region utils copied from typescript to prevent loading the entire typescriptServices ---
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import type * as mode from './tsMode';
|
import type * as mode from './tsMode';
|
||||||
import { typescriptVersion as tsversion } from './lib/typescriptServicesMetadata'; // do not import the whole typescriptServices here
|
import { typescriptVersion as tsversion } from './lib/typescriptServicesMetadata'; // do not import the whole typescriptServices here
|
||||||
import { languages, Emitter, IEvent, IDisposable, Uri } from '../fillers/monaco-editor-core';
|
import { languages, Emitter, IEvent, IDisposable, Uri } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
//#region enums copied from typescript to prevent loading the entire typescriptServices ---
|
//#region enums copied from typescript to prevent loading the entire typescriptServices ---
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import * as edworker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
import * as edworker from 'monaco-editor-core/esm/vs/editor/editor.worker';
|
||||||
import { ICreateData, create } from './tsWorker';
|
import { ICreateData, create } from './tsWorker';
|
||||||
import { worker } from '../fillers/monaco-editor-core';
|
import { worker } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
self.onmessage = () => {
|
self.onmessage = () => {
|
||||||
// ignore the first message
|
// ignore the first message
|
||||||
|
|
@ -7,7 +7,7 @@ import { WorkerManager } from './workerManager';
|
||||||
import type { TypeScriptWorker } from './tsWorker';
|
import type { TypeScriptWorker } from './tsWorker';
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import * as languageFeatures from './languageFeatures';
|
import * as languageFeatures from './languageFeatures';
|
||||||
import { languages, Uri } from '../fillers/monaco-editor-core';
|
import { languages, Uri } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
let javaScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
|
let javaScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
|
||||||
let typeScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
|
let typeScriptWorker: (...uris: Uri[]) => Promise<TypeScriptWorker>;
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
IExtraLibs,
|
IExtraLibs,
|
||||||
TypeScriptWorker as ITypeScriptWorker
|
TypeScriptWorker as ITypeScriptWorker
|
||||||
} from './monaco.contribution';
|
} from './monaco.contribution';
|
||||||
import { Uri, worker } from '../fillers/monaco-editor-core';
|
import { Uri, worker } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading a default lib as a source file will mess up TS completely.
|
* Loading a default lib as a source file will mess up TS completely.
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { LanguageServiceDefaults } from './monaco.contribution';
|
import { LanguageServiceDefaults } from './monaco.contribution';
|
||||||
import type { TypeScriptWorker } from './tsWorker';
|
import type { TypeScriptWorker } from './tsWorker';
|
||||||
import { editor, Uri, IDisposable } from '../fillers/monaco-editor-core';
|
import { editor, Uri, IDisposable } from '../../fillers/monaco-editor-core';
|
||||||
|
|
||||||
export class WorkerManager {
|
export class WorkerManager {
|
||||||
private _modeId: string;
|
private _modeId: string;
|
||||||
|
|
@ -209,13 +209,9 @@
|
||||||
let loaderPathsConfig = {};
|
let loaderPathsConfig = {};
|
||||||
window.AMD = true;
|
window.AMD = true;
|
||||||
if (IS_FILE_PROTOCOL) {
|
if (IS_FILE_PROTOCOL) {
|
||||||
loaderPathsConfig['vs/language/fillers/monaco-editor-core'] =
|
|
||||||
DIRNAME + '/../.././out/amd/fillers/monaco-editor-core-amd';
|
|
||||||
loaderPathsConfig['vs/fillers/monaco-editor-core'] =
|
loaderPathsConfig['vs/fillers/monaco-editor-core'] =
|
||||||
DIRNAME + '/../.././out/amd/fillers/monaco-editor-core-amd';
|
DIRNAME + '/../.././out/amd/fillers/monaco-editor-core-amd';
|
||||||
} else {
|
} else {
|
||||||
loaderPathsConfig['vs/language/fillers/monaco-editor-core'] =
|
|
||||||
PATH_PREFIX + '/monaco-editor/./out/amd/fillers/monaco-editor-core-amd';
|
|
||||||
loaderPathsConfig['vs/fillers/monaco-editor-core'] =
|
loaderPathsConfig['vs/fillers/monaco-editor-core'] =
|
||||||
PATH_PREFIX + '/monaco-editor/./out/amd/fillers/monaco-editor-core-amd';
|
PATH_PREFIX + '/monaco-editor/./out/amd/fillers/monaco-editor-core-amd';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue