mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
commit
1bd93df64b
4 changed files with 713 additions and 677 deletions
|
|
@ -63,6 +63,7 @@ Some languages share the same web worker. If one of the following languages is i
|
||||||
|
|
||||||
* `features` (`string[]`) - include only a subset of the editor features.
|
* `features` (`string[]`) - include only a subset of the editor features.
|
||||||
* 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']`.
|
* 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']`.
|
||||||
|
* excluded features: It is also possible to exclude certain default features prefixing them with an exclamation mark '!'.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
||||||
23
index.js
23
index.js
|
|
@ -28,10 +28,31 @@ const languagesById = fromPairs(
|
||||||
);
|
);
|
||||||
const featuresById = mapValues(FEATURES, (feature, key) => mixin({ label: key }, feature))
|
const featuresById = mapValues(FEATURES, (feature, key) => mixin({ label: key }, feature))
|
||||||
|
|
||||||
|
function getFeaturesIds(userFeatures, predefinedFeaturesById) {
|
||||||
|
function notContainedIn(arr) {
|
||||||
|
return (element) => arr.indexOf(element) === -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let featuresIds;
|
||||||
|
|
||||||
|
if (userFeatures.length) {
|
||||||
|
const excludedFeatures = userFeatures.filter(f => f[0] === '!').map(f => f.slice(1));
|
||||||
|
if (excludedFeatures.length) {
|
||||||
|
featuresIds = Object.keys(predefinedFeaturesById).filter(notContainedIn(excludedFeatures))
|
||||||
|
} else {
|
||||||
|
featuresIds = userFeatures;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
featuresIds = Object.keys(predefinedFeaturesById);
|
||||||
|
}
|
||||||
|
|
||||||
|
return featuresIds;
|
||||||
|
}
|
||||||
|
|
||||||
class MonacoWebpackPlugin {
|
class MonacoWebpackPlugin {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
const languages = options.languages || Object.keys(languagesById);
|
const languages = options.languages || Object.keys(languagesById);
|
||||||
const features = options.features || Object.keys(featuresById);
|
const features = getFeaturesIds(options.features || [], featuresById);
|
||||||
const output = options.output || '';
|
const output = options.output || '';
|
||||||
this.options = {
|
this.options = {
|
||||||
languages: languages.map((id) => languagesById[id]).filter(Boolean),
|
languages: languages.map((id) => languagesById[id]).filter(Boolean),
|
||||||
|
|
|
||||||
1364
package-lock.json
generated
1364
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -16,6 +16,6 @@ module.exports = {
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new MonacoWebpackPlugin()
|
new MonacoWebpackPlugin({features: ['!contextmenu']})
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue