Stronger typing for the options

pull/2748/head
Alex Dima 5 years ago
parent bad4bcfe35
commit 00036c08f3
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0

@ -152,6 +152,11 @@ export const languagesArr: IFeatureDefinition[] = ${
.replace(/"id":/g, 'id:')
.replace(/"/g, '\'')
};
export type EditorLanguage = ${
result.map(el => `'${el.label}'`).join(' | ')
};
`
fs.writeFileSync(path.join(__dirname, '../src/languages.ts'), code.replace(/\r\n/g, '\n'));
});
@ -232,6 +237,14 @@ export const featuresArr: IFeatureDefinition[] = ${
.replace(/"entry":/g, 'entry:')
.replace(/"/g, '\'')
};
export type EditorFeature = ${
result.map(el => `'${el.label}'`).join(' | ')
};
export type NegatedEditorFeature = ${
result.map(el => `'!${el.label}'`).join(' | ')
};
`
fs.writeFileSync(path.join(__dirname, '../src/features.ts'), code.replace(/\r\n/g, '\n'));
}

@ -173,3 +173,7 @@ export const featuresArr: IFeatureDefinition[] = [
entry: 'vs/editor/contrib/wordPartOperations/wordPartOperations'
}
];
export type EditorFeature = 'accessibilityHelp' | 'bracketMatching' | 'caretOperations' | 'clipboard' | 'codeAction' | 'codelens' | 'colorDetector' | 'comment' | 'contextmenu' | 'coreCommands' | 'cursorUndo' | 'dnd' | 'find' | 'folding' | 'fontZoom' | 'format' | 'goToDefinitionCommands' | 'goToDefinitionMouse' | 'gotoError' | 'gotoLine' | 'hover' | 'iPadShowKeyboard' | 'inPlaceReplace' | 'inspectTokens' | 'linesOperations' | 'links' | 'multicursor' | 'parameterHints' | 'quickCommand' | 'quickOutline' | 'referenceSearch' | 'rename' | 'smartSelect' | 'snippets' | 'suggest' | 'toggleHighContrast' | 'toggleTabFocusMode' | 'transpose' | 'wordHighlighter' | 'wordOperations' | 'wordPartOperations';
export type NegatedEditorFeature = '!accessibilityHelp' | '!bracketMatching' | '!caretOperations' | '!clipboard' | '!codeAction' | '!codelens' | '!colorDetector' | '!comment' | '!contextmenu' | '!coreCommands' | '!cursorUndo' | '!dnd' | '!find' | '!folding' | '!fontZoom' | '!format' | '!goToDefinitionCommands' | '!goToDefinitionMouse' | '!gotoError' | '!gotoLine' | '!hover' | '!iPadShowKeyboard' | '!inPlaceReplace' | '!inspectTokens' | '!linesOperations' | '!links' | '!multicursor' | '!parameterHints' | '!quickCommand' | '!quickOutline' | '!referenceSearch' | '!rename' | '!smartSelect' | '!snippets' | '!suggest' | '!toggleHighContrast' | '!toggleTabFocusMode' | '!transpose' | '!wordHighlighter' | '!wordOperations' | '!wordPartOperations';

@ -3,8 +3,8 @@ import * as webpack from 'webpack';
import * as loaderUtils from 'loader-utils';
import * as fs from 'fs';
import { AddWorkerEntryPointPlugin } from './plugins/AddWorkerEntryPointPlugin';
import { languagesArr } from './languages';
import { featuresArr } from './features';
import { languagesArr, EditorLanguage } from './languages';
import { featuresArr, EditorFeature, NegatedEditorFeature } from './features';
import { IFeatureDefinition } from './types';
const INCLUDE_LOADER_PATH = require.resolve('./loaders/include');
@ -65,13 +65,13 @@ interface IMonacoEditorWebpackPluginOpts {
/**
* Include only a subset of the languages supported.
*/
languages?: string[];
languages?: EditorLanguage[];
/**
* Include only a subset of the editor features.
* Use e.g. '!contextmenu' to exclude a certain feature.
*/
features?: string[];
features?: (EditorFeature | NegatedEditorFeature)[];
/**
* Specify a filename template to use for generated files.

@ -267,3 +267,6 @@ export const languagesArr: IFeatureDefinition[] = [
entry: 'vs/basic-languages/yaml/yaml.contribution'
}
];
export type EditorLanguage = 'abap' | 'apex' | 'azcli' | 'bat' | 'clojure' | 'coffee' | 'cpp' | 'csharp' | 'csp' | 'css' | 'dockerfile' | 'fsharp' | 'go' | 'graphql' | 'handlebars' | 'html' | 'ini' | 'java' | 'javascript' | 'json' | 'kotlin' | 'less' | 'lua' | 'markdown' | 'mips' | 'msdax' | 'mysql' | 'objective-c' | 'pascal' | 'pascaligo' | 'perl' | 'pgsql' | 'php' | 'postiats' | 'powerquery' | 'powershell' | 'pug' | 'python' | 'r' | 'razor' | 'redis' | 'redshift' | 'ruby' | 'rust' | 'sb' | 'scheme' | 'scss' | 'shell' | 'solidity' | 'sophia' | 'sql' | 'st' | 'swift' | 'tcl' | 'twig' | 'typescript' | 'vb' | 'xml' | 'yaml';

Loading…
Cancel
Save