mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Align languages with upcoming editor release
This commit is contained in:
parent
e605ab21ef
commit
f86321e052
4 changed files with 64 additions and 26 deletions
|
|
@ -49,9 +49,9 @@ Options can be passed in to `MonacoWebpackPlugin`. They can be used to generate
|
|||
* `output` (`string`) - custom output path for worker scripts, relative to the main webpack `output.path`.
|
||||
* default value: `''`.
|
||||
* `languages` (`string[]`) - include only a subset of the languages supported.
|
||||
* default value: `['bat', 'coffee', 'cpp', 'csharp', 'csp', 'css', 'dockerfile', 'fsharp', 'go', 'handlebars', 'html', 'ini', 'java', 'json', 'less', 'lua', 'markdown', 'msdax', 'mysql', 'objective', 'pgsql', 'php', 'postiats', 'powershell', 'pug', 'python', 'r', 'razor', 'redis', 'redshift', 'ruby', 'sb', 'scss', 'solidity', 'sql', 'swift', 'typescript', 'vb', 'xml', 'yaml']`.
|
||||
* default value: `['apex', 'azcli', 'bat', 'clojure', 'coffee', 'cpp', 'csharp', 'csp', 'css', 'dockerfile', 'fsharp', 'go', 'handlebars', 'html', 'ini', 'java', 'javascript', 'json', 'less', 'lua', 'markdown', 'msdax', 'mysql', 'objective', 'perl', 'pgsql', 'php', 'postiats', 'powerquery', 'powershell', 'pug', 'python', 'r', 'razor', 'redis', 'redshift', 'ruby', 'rust', 'sb', 'scheme', 'scss', 'shell', 'solidity', 'sql', 'st', 'swift', 'typescript', 'vb', 'xml', 'yaml']`.
|
||||
* `features` (`string[]`) - include only a subset of the editor features.
|
||||
* default value: `['accessibilityHelp', 'bracketMatching', 'caretOperations', 'clipboard', 'codelens', 'colorDetector', 'comment', 'contextmenu', 'coreCommands', 'cursorUndo', 'dnd', 'find', 'folding', 'format', 'gotoDeclarationCommands', 'gotoDeclarationMouse', 'gotoError', 'gotoLine', 'hover', 'inPlaceReplace', 'inspectTokens', 'iPadShowKeyboard', 'linesOperations', 'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickFixCommands', 'quickOutline', 'referenceSearch', 'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode', 'transpose', 'wordHighlighter', 'wordOperations']`.
|
||||
* default value: `['accessibilityHelp', 'bracketMatching', 'caretOperations', 'clipboard', 'codeAction', 'codelens', 'colorDetector', 'comment', 'contextmenu', 'coreCommands', 'cursorUndo', 'dnd', 'find', 'folding', 'fontZoom', 'format', 'goToDefinitionCommands', 'goToDefinitionMouse', 'gotoError', 'gotoLine', 'hover', 'inPlaceReplace', 'inspectTokens', 'iPadShowKeyboard', 'linesOperations', 'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickOutline', 'referenceSearch', 'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode', 'transpose', 'wordHighlighter', 'wordOperations', 'wordPartOperations']`.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
|||
28
index.js
28
index.js
|
|
@ -3,15 +3,6 @@ const webpack = require('webpack');
|
|||
const AddWorkerEntryPointPlugin = require('./plugins/AddWorkerEntryPointPlugin');
|
||||
const INCLUDE_LOADER_PATH = require.resolve('./loaders/include');
|
||||
|
||||
const IGNORED_IMPORTS = {
|
||||
[resolveMonacoPath('vs/language/typescript/lib/typescriptServices')]: [
|
||||
'fs',
|
||||
'path',
|
||||
'os',
|
||||
'crypto',
|
||||
'source-map-support',
|
||||
],
|
||||
};
|
||||
const MONACO_EDITOR_API_PATHS = [
|
||||
resolveMonacoPath('vs/editor/editor.main'),
|
||||
resolveMonacoPath('vs/editor/editor.api')
|
||||
|
|
@ -87,6 +78,15 @@ function createLoaderRules(languages, features, workers, outputPath, publicPath)
|
|||
const languagePaths = flatArr(languages.map(({ entry }) => entry).filter(Boolean));
|
||||
const featurePaths = flatArr(features.map(({ entry }) => entry).filter(Boolean));
|
||||
const workerPaths = fromPairs(workers.map(({ label, output }) => [label, path.join(outputPath, output)]));
|
||||
if (workerPaths['typescript']) {
|
||||
// javascript shares the same worker
|
||||
workerPaths['javascript'] = workerPaths['typescript'];
|
||||
}
|
||||
if (workerPaths['css']) {
|
||||
// scss and less share the same worker
|
||||
workerPaths['less'] = workerPaths['css'];
|
||||
workerPaths['scss'] = workerPaths['css'];
|
||||
}
|
||||
|
||||
const globals = {
|
||||
'MonacoEnvironment': `(function (paths) {
|
||||
|
|
@ -125,9 +125,6 @@ function createPlugins(workers, outputPath) {
|
|||
}) : acc), {});
|
||||
return (
|
||||
[]
|
||||
.concat(Object.keys(IGNORED_IMPORTS).map((id) =>
|
||||
createIgnoreImportsPlugin(id, IGNORED_IMPORTS[id])
|
||||
))
|
||||
.concat(uniqBy(workers, ({ id }) => id).map(({ id, entry, output }) =>
|
||||
new AddWorkerEntryPointPlugin({
|
||||
id,
|
||||
|
|
@ -151,13 +148,6 @@ function createContextPlugin(filePath, contextPaths) {
|
|||
);
|
||||
}
|
||||
|
||||
function createIgnoreImportsPlugin(targetPath, ignoredModules) {
|
||||
return new webpack.IgnorePlugin(
|
||||
new RegExp(`^(${ignoredModules.map((id) => `(${id})`).join('|')})$`),
|
||||
new RegExp(`^${path.dirname(targetPath).replace(/[\/\\]/g, '(/|\\\\)')}$`)
|
||||
);
|
||||
}
|
||||
|
||||
function flatMap(items, iteratee) {
|
||||
return items.map(iteratee).reduce((acc, item) => [].concat(acc).concat(item), []);
|
||||
}
|
||||
|
|
|
|||
57
languages.js
57
languages.js
|
|
@ -1,9 +1,24 @@
|
|||
module.exports = {
|
||||
apex: {
|
||||
entry: 'vs/basic-languages/apex/apex.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
azcli: {
|
||||
entry: 'vs/basic-languages/azcli/azcli.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
bat: {
|
||||
entry: 'vs/basic-languages/bat/bat.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
clojure: {
|
||||
entry: 'vs/basic-languages/clojure/clojure.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
coffee: {
|
||||
entry: 'vs/basic-languages/coffee/coffee.contribution',
|
||||
worker: undefined,
|
||||
|
|
@ -25,7 +40,10 @@ module.exports = {
|
|||
alias: undefined,
|
||||
},
|
||||
css: {
|
||||
entry: 'vs/language/css/monaco.contribution',
|
||||
entry: [
|
||||
'vs/basic-languages/css/css.contribution',
|
||||
'vs/language/css/monaco.contribution',
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/css/cssWorker',
|
||||
entry: 'vs/language/css/css.worker',
|
||||
|
|
@ -55,7 +73,10 @@ module.exports = {
|
|||
alias: undefined,
|
||||
},
|
||||
html: {
|
||||
entry: 'vs/language/html/monaco.contribution',
|
||||
entry: [
|
||||
'vs/basic-languages/html/html.contribution',
|
||||
'vs/language/html/monaco.contribution',
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/html/htmlWorker',
|
||||
entry: 'vs/language/html/html.worker',
|
||||
|
|
@ -74,6 +95,11 @@ module.exports = {
|
|||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
javascript: {
|
||||
entry: 'vs/basic-languages/javascript/javascript.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
json: {
|
||||
entry: 'vs/language/json/monaco.contribution',
|
||||
worker: {
|
||||
|
|
@ -114,6 +140,11 @@ module.exports = {
|
|||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
perl: {
|
||||
entry: 'vs/basic-languages/perl/perl.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
pgsql: {
|
||||
entry: 'vs/basic-languages/pgsql/pgsql.contribution',
|
||||
worker: undefined,
|
||||
|
|
@ -129,6 +160,11 @@ module.exports = {
|
|||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
powerquery: {
|
||||
entry: 'vs/basic-languages/powerquery/powerquery.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
powershell: {
|
||||
entry: 'vs/basic-languages/powershell/powershell.contribution',
|
||||
worker: undefined,
|
||||
|
|
@ -179,11 +215,21 @@ module.exports = {
|
|||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
scheme: {
|
||||
entry: 'vs/basic-languages/scheme/scheme.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
scss: {
|
||||
entry: 'vs/basic-languages/scss/scss.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
shell: {
|
||||
entry: 'vs/basic-languages/shell/shell.contribution',
|
||||
worker: undefined,
|
||||
alias: undefined,
|
||||
},
|
||||
solidity: {
|
||||
entry: 'vs/basic-languages/solidity/solidity.contribution',
|
||||
worker: undefined,
|
||||
|
|
@ -205,14 +251,17 @@ module.exports = {
|
|||
alias: undefined,
|
||||
},
|
||||
typescript: {
|
||||
entry: 'vs/language/typescript/monaco.contribution',
|
||||
entry: [
|
||||
'vs/basic-languages/typescript/typescript.contribution',
|
||||
'vs/language/typescript/monaco.contribution',
|
||||
],
|
||||
worker: {
|
||||
id: 'vs/language/typescript/tsWorker',
|
||||
entry: 'vs/language/typescript/ts.worker',
|
||||
output: 'typescript.worker.js',
|
||||
fallback: 'vs/language/typescript/tsWorker',
|
||||
},
|
||||
alias: ['javascript'],
|
||||
alias: undefined,
|
||||
},
|
||||
vb: {
|
||||
entry: 'vs/basic-languages/vb/vb.contribution',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
const webpack = require('webpack');
|
||||
const webpackVersion = require('webpack/package.json').version;
|
||||
const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
|
||||
const LoaderTargetPlugin = require('webpack/lib/LoaderTargetPlugin');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue