diff options
author | Phil Hughes <me@iamphill.com> | 2018-09-28 12:30:02 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-11-26 11:01:58 +0000 |
commit | 1cd97bb64b2a4076433d0ef540d9ca2528312497 (patch) | |
tree | 6a15bc8314513030ca3655ba7f7c54e8c4daa367 | |
parent | b55aeca25e70cf884c08afaa4b4d84d9ac772c35 (diff) | |
download | gitlab-ce-ide-wasm.tar.gz |
Added textmate grammars to IDEide-wasm
-rw-r--r-- | app/assets/javascripts/ide/lib/editor.js | 85 | ||||
-rw-r--r-- | app/assets/javascripts/ide/lib/themes/gl_theme.js | 1473 | ||||
-rw-r--r-- | config/webpack.config.js | 5 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | yarn.lock | 29 |
5 files changed, 1592 insertions, 4 deletions
diff --git a/app/assets/javascripts/ide/lib/editor.js b/app/assets/javascripts/ide/lib/editor.js index 02038fcb534..a83d98f61ab 100644 --- a/app/assets/javascripts/ide/lib/editor.js +++ b/app/assets/javascripts/ide/lib/editor.js @@ -1,5 +1,9 @@ import _ from 'underscore'; -import { editor as monacoEditor, KeyCode, KeyMod } from 'monaco-editor'; +import { editor as monacoEditor, languages, KeyCode, KeyMod } from 'monaco-editor'; +import { loadWASM } from 'onigasm'; +import { Registry } from 'monaco-textmate'; +import { wireTmGrammars } from 'monaco-editor-textmate'; +import { grammars as textmateGrammars } from 'monaco-textmate-languages/dist/manifest'; import store from '../stores'; import DecorationsController from './decorations/controller'; import DirtyDiffController from './diff/controller'; @@ -9,11 +13,63 @@ import editorOptions, { defaultEditorOptions } from './editor_options'; import gitlabTheme from './themes/gl_theme'; import keymap from './keymap.json'; +languages.register({ id: 'vue', extensions: ['vue'], mimeTypes: ['text/html'] }); + +function standardizeColor(color) { + return color ? color.replace(/^#/, '') : color; +} + function setupMonacoTheme() { - monacoEditor.defineTheme(gitlabTheme.themeName, gitlabTheme.monacoTheme); - monacoEditor.setTheme('gitlab'); + monacoEditor.defineTheme(gitlabTheme.themeName, { + ...gitlabTheme.monacoTheme, + rules: gitlabTheme.monacoTheme.rules.reduce( + (acc, token) => + acc.concat( + (typeof token.scope === 'string' ? token.scope.split(',') : token.scope).map(s => ({ + token: s.trim(), + foreground: standardizeColor(token.settings.foreground), + background: standardizeColor(token.settings.background), + fontStyle: token.settings.fontStyle, + })), + ), + [], + ), + }); + monacoEditor.setTheme(gitlabTheme.themeName); } +let onigasmLoaded = false; +const loadSyntaxHighlighting = () => { + // eslint-disable-next-line global-require + (onigasmLoaded ? Promise.resolve() : loadWASM(require('onigasm/lib/onigasm.wasm'))) + .then(() => { + onigasmLoaded = true; + + const registry = new Registry({ + getGrammarDefinition: scopeName => { + const { path } = textmateGrammars.find(g => g.scopeName === scopeName); + return import(`monaco-textmate-languages/grammars/${path}`).then(content => ({ + format: 'json', + content: content.default, + })); + }, + }); + + const grammars = new Map(); + grammars.set('typescript', 'source.tsx'); + grammars.set('javascript', 'source.tsx'); + grammars.set('vue', 'text.html.vue'); + grammars.set('html', 'text.html.basic'); + grammars.set('css', 'source.css'); + grammars.set('json', 'source.json'); + + return wireTmGrammars(window.monaco, registry, grammars); + }) + .catch(e => { + throw e; + }); +}; + export const clearDomElement = el => { if (!el || !el.firstChild) return; @@ -38,6 +94,25 @@ export default class Editor { this.modelManager = new ModelManager(); this.decorationsController = new DecorationsController(this); + languages + .getLanguages() + .filter( + l => + l.id === 'javascript' || + l.id === 'typescript' || + l.id === 'html' || + l.id === 'css' || + l.id === 'json', + ) + .forEach(lang => { + // eslint-disable-next-line no-param-reassign + lang.loader = () => + Promise.resolve({ + language: { tokenizer: { root: [] } }, + conf: {}, + }); + }); + setupMonacoTheme(); this.debouncedUpdate = _.debounce(() => { @@ -118,6 +193,10 @@ export default class Editor { ); if (this.dirtyDiffController) this.dirtyDiffController.reDecorate(model); + + if (typeof WebAssembly === 'object') { + loadSyntaxHighlighting(); + } } attachMergeRequestModel(model) { diff --git a/app/assets/javascripts/ide/lib/themes/gl_theme.js b/app/assets/javascripts/ide/lib/themes/gl_theme.js index 439ae50448a..9f0e2a51f2b 100644 --- a/app/assets/javascripts/ide/lib/themes/gl_theme.js +++ b/app/assets/javascripts/ide/lib/themes/gl_theme.js @@ -3,7 +3,1478 @@ export default { monacoTheme: { base: 'vs', inherit: true, - rules: [], + rules: [ + { + name: 'Comment', + scope: ['comment'], + settings: { + foreground: '#A0A1A7', + fontStyle: 'italic', + }, + }, + { + name: 'Comment Markup Link', + scope: ['comment markup.link'], + settings: { + foreground: '#A0A1A7', + }, + }, + { + name: 'Entity Name Type', + scope: ['entity.name.type'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Entity Other Inherited Class', + scope: ['entity.other.inherited-class'], + settings: { + foreground: '#50A14F', + }, + }, + { + name: 'Keyword', + scope: ['keyword'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Keyword Control', + scope: ['keyword.control'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Keyword Operator', + scope: ['keyword.operator'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Keyword Other Special Method', + scope: ['keyword.other.special-method'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Keyword Other Unit', + scope: ['keyword.other.unit'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Storage', + scope: ['storage'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Storage Type Annotation,storage Type Primitive', + scope: ['storage.type.annotation', 'storage.type.primitive'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Storage Modifier Package,storage Modifier Import', + scope: ['storage.modifier.package', 'storage.modifier.import'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Constant', + scope: ['constant'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Constant Variable', + scope: ['constant.variable'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Constant Character Escape', + scope: ['constant.character.escape'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Constant Numeric', + scope: ['constant.numeric'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Constant Other Color', + scope: ['constant.other.color'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Constant Other Symbol', + scope: ['constant.other.symbol'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Variable', + scope: ['variable'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Variable Interpolation', + scope: ['variable.interpolation'], + settings: { + foreground: '#CA1243', + }, + }, + { + name: 'Variable Parameter', + scope: ['variable.parameter'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'String', + scope: ['string'], + settings: { + foreground: '#50A14F', + }, + }, + { + name: 'String Regexp', + scope: ['string.regexp'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'String Regexp Source Ruby Embedded', + scope: ['string.regexp source.ruby.embedded'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'String Other Link', + scope: ['string.other.link'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Punctuation Definition Comment', + scope: ['punctuation.definition.comment'], + settings: { + foreground: '#A0A1A7', + }, + }, + { + name: + 'Punctuation Definition Method Parameters,punctuation Definition Function Parameters,punctuation Definition Parameters,punctuation Definition Separator,punctuation Definition Seperator,punctuation Definition Array', + scope: [ + 'punctuation.definition.method-parameters', + 'punctuation.definition.function-parameters', + 'punctuation.definition.parameters', + 'punctuation.definition.separator', + 'punctuation.definition.seperator', + 'punctuation.definition.array', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Punctuation Definition Heading,punctuation Definition Identity', + scope: ['punctuation.definition.heading', 'punctuation.definition.identity'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Punctuation Definition Bold', + scope: ['punctuation.definition.bold'], + settings: { + foreground: '#C18401', + fontStyle: 'bold', + }, + }, + { + name: 'Punctuation Definition Italic', + scope: ['punctuation.definition.italic'], + settings: { + foreground: '#A626A4', + fontStyle: 'italic', + }, + }, + { + name: 'Punctuation Section Embedded', + scope: ['punctuation.section.embedded'], + settings: { + foreground: '#CA1243', + }, + }, + { + name: + 'Punctuation Section Method,punctuation Section Class,punctuation Section Inner Class', + scope: [ + 'punctuation.section.method', + 'punctuation.section.class', + 'punctuation.section.inner-class', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Support Class', + scope: ['support.class'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Support Type', + scope: ['support.type'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Support Function', + scope: ['support.function'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Support Function Any Method', + scope: ['support.function.any-method'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Entity Name Function', + scope: ['entity.name.function'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Entity Name Class,entity Name Type Class', + scope: ['entity.name.class', 'entity.name.type.class'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Entity Name Section', + scope: ['entity.name.section'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Entity Name Tag', + scope: ['entity.name.tag'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Entity Other Attribute Name', + scope: ['entity.other.attribute-name'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Entity Other Attribute Name Id', + scope: ['entity.other.attribute-name.id'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Meta Class', + scope: ['meta.class'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Meta Class Body', + scope: ['meta.class.body'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Meta Method Call,meta Method', + scope: ['meta.method-call', 'meta.method'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Meta Definition Variable', + scope: ['meta.definition.variable'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Meta Link', + scope: ['meta.link'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Meta Require', + scope: ['meta.require'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Meta Selector', + scope: ['meta.selector'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Meta Separator', + scope: ['meta.separator'], + settings: { + background: '#373B41', + foreground: '#383A42', + }, + }, + { + name: 'Meta Tag', + scope: ['meta.tag'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Underline', + scope: ['underline'], + settings: { + 'text-decoration': 'underline', + }, + }, + { + name: 'None', + scope: ['none'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Invalid Deprecated', + scope: ['invalid.deprecated'], + settings: { + foreground: '#000000', + background: '#F2A60D', + }, + }, + { + name: 'Invalid Illegal', + scope: ['invalid.illegal'], + settings: { + foreground: '#ff0000', + background: '#FF1414', + }, + }, + { + name: 'Markup Bold', + scope: ['markup.bold'], + settings: { + foreground: '#986801', + fontStyle: 'bold', + }, + }, + { + name: 'Markup Changed', + scope: ['markup.changed'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Markup Deleted', + scope: ['markup.deleted'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Markup Italic', + scope: ['markup.italic'], + settings: { + foreground: '#A626A4', + fontStyle: 'italic', + }, + }, + { + name: 'Markup Heading', + scope: ['markup.heading'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Markup Heading Punctuation Definition Heading', + scope: ['markup.heading punctuation.definition.heading'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Markup Link', + scope: ['markup.link'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Markup Inserted', + scope: ['markup.inserted'], + settings: { + foreground: '#50A14F', + }, + }, + { + name: 'Markup Quote', + scope: ['markup.quote'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Markup Raw', + scope: ['markup.raw'], + settings: { + foreground: '#50A14F', + }, + }, + { + name: 'Source C Keyword Operator', + scope: ['source.c keyword.operator'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Cpp Keyword Operator', + scope: ['source.cpp keyword.operator'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Cs Keyword Operator', + scope: ['source.cs keyword.operator'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Css Property Name,source Css Property Value', + scope: ['source.css property-name', 'source.css property-value'], + settings: { + foreground: '#696C77', + }, + }, + { + name: 'Source Css Property Name Support,source Css Property Value Support', + scope: ['source.css property-name.support', 'source.css property-value.support'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Source Gfm Markup', + scope: ['source.gfm markup'], + settings: { + '-webkit-font-smoothing': 'auto', + }, + }, + { + name: 'Source Gfm Link Entity', + scope: ['source.gfm link entity'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: 'Source Go Storage Type String', + scope: ['source.go storage.type.string'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Ini Keyword Other Definition Ini', + scope: ['source.ini keyword.other.definition.ini'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Source Java Storage Modifier Import', + scope: ['source.java storage.modifier.import'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Source Java Storage Type', + scope: ['source.java storage.type'], + settings: { + foreground: '#C18401', + }, + }, + { + name: 'Source Java Keyword Operator Instanceof', + scope: ['source.java keyword.operator.instanceof'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Java Properties Meta Key Pair', + scope: ['source.java-properties meta.key-pair'], + settings: { + foreground: '#E45649', + }, + }, + { + name: 'Source Java Properties Meta Key Pair > Punctuation', + scope: ['source.java-properties meta.key-pair > punctuation'], + settings: { + foreground: '#383A42', + }, + }, + { + name: 'Source Js Keyword Operator', + scope: ['source.js keyword.operator'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: + 'Source Js Keyword Operator Delete,source Js Keyword Operator In,source Js Keyword Operator Of,source Js Keyword Operator Instanceof,source Js Keyword Operator New,source Js Keyword Operator Typeof,source Js Keyword Operator Void', + scope: [ + 'source.js keyword.operator.delete', + 'source.js keyword.operator.in', + 'source.js keyword.operator.of', + 'source.js keyword.operator.instanceof', + 'source.js keyword.operator.new', + 'source.js keyword.operator.typeof', + 'source.js keyword.operator.void', + ], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Json Meta Structure Dictionary Json > String Quoted Json', + scope: ['source.json meta.structure.dictionary.json > string.quoted.json'], + settings: { + foreground: '#E45649', + }, + }, + { + name: + 'Source Json Meta Structure Dictionary Json > String Quoted Json > Punctuation String', + scope: [ + 'source.json meta.structure.dictionary.json > string.quoted.json > punctuation.string', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: + 'Source Json Meta Structure Dictionary Json > Value Json > String Quoted Json,source Json Meta Structure Array Json > Value Json > String Quoted Json,source Json Meta Structure Dictionary Json > Value Json > String Quoted Json > Punctuation,source Json Meta Structure Array Json > Value Json > String Quoted Json > Punctuation', + scope: [ + 'source.json meta.structure.dictionary.json > value.json > string.quoted.json', + 'source.json meta.structure.array.json > value.json > string.quoted.json', + 'source.json meta.structure.dictionary.json > value.json > string.quoted.json > punctuation', + 'source.json meta.structure.array.json > value.json > string.quoted.json > punctuation', + ], + settings: { + foreground: '#50A14F', + }, + }, + { + name: + 'Source Json Meta Structure Dictionary Json > Constant Language Json,source Json Meta Structure Array Json > Constant Language Json', + scope: [ + 'source.json meta.structure.dictionary.json > constant.language.json', + 'source.json meta.structure.array.json > constant.language.json', + ], + settings: { + foreground: '#0184BC', + }, + }, + { + name: 'Source Ruby Constant Other Symbol > Punctuation', + scope: ['source.ruby constant.other.symbol > punctuation'], + settings: { + foreground: '#ffffff', + }, + }, + { + name: 'Source Python Keyword Operator Logical Python', + scope: ['source.python keyword.operator.logical.python'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: 'Source Python Variable Parameter', + scope: ['source.python variable.parameter'], + settings: { + foreground: '#986801', + }, + }, + { + name: 'Meta Attribute Rust', + scope: ['meta.attribute.rust'], + settings: { + foreground: '#606135', + }, + }, + { + name: 'Storage Modifier Lifetime Rust,entity Name Lifetime Rust', + scope: ['storage.modifier.lifetime.rust', 'entity.name.lifetime.rust'], + settings: { + foreground: '#11C4C6', + }, + }, + { + name: 'Keyword Unsafe Rust', + scope: ['keyword.unsafe.rust'], + settings: { + foreground: '#882328', + }, + }, + { + name: 'customrule', + scope: 'customrule', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Support Type Property Name', + scope: 'support.type.property-name', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Punctuation for Quoted String', + scope: 'string.quoted.double punctuation', + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] Support Constant', + scope: 'support.constant', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] JSON Property Name', + scope: 'support.type.property-name.json', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JSON Punctuation for Property Name', + scope: 'support.type.property-name.json punctuation', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation for key-value', + scope: [ + 'punctuation.separator.key-value.ts', + 'punctuation.separator.key-value.js', + 'punctuation.separator.key-value.tsx', + ], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Embedded Operator', + scope: [ + 'source.js.embedded.html keyword.operator', + 'source.ts.embedded.html keyword.operator', + ], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Variable Other Readwrite', + scope: [ + 'variable.other.readwrite.js', + 'variable.other.readwrite.ts', + 'variable.other.readwrite.tsx', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Support Variable Dom', + scope: ['support.variable.dom.js', 'support.variable.dom.ts'], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Support Variable Property Dom', + scope: ['support.variable.property.dom.js', 'support.variable.property.dom.ts'], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Interpolation String Punctuation', + scope: [ + 'meta.template.expression.js punctuation.definition', + 'meta.template.expression.ts punctuation.definition', + ], + settings: { + foreground: '#CA1243', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation Type Parameters', + scope: [ + 'source.ts punctuation.definition.typeparameters', + 'source.js punctuation.definition.typeparameters', + 'source.tsx punctuation.definition.typeparameters', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Definition Block', + scope: [ + 'source.ts punctuation.definition.block', + 'source.js punctuation.definition.block', + 'source.tsx punctuation.definition.block', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation Separator Comma', + scope: [ + 'source.ts punctuation.separator.comma', + 'source.js punctuation.separator.comma', + 'source.tsx punctuation.separator.comma', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Variable Property', + scope: [ + 'support.variable.property.js', + 'support.variable.property.ts', + 'support.variable.property.tsx', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Default Keyword', + scope: [ + 'keyword.control.default.js', + 'keyword.control.default.ts', + 'keyword.control.default.tsx', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Instanceof Keyword', + scope: [ + 'keyword.operator.expression.instanceof.js', + 'keyword.operator.expression.instanceof.ts', + 'keyword.operator.expression.instanceof.tsx', + ], + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Of Keyword', + scope: [ + 'keyword.operator.expression.of.js', + 'keyword.operator.expression.of.ts', + 'keyword.operator.expression.of.tsx', + ], + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Braces/Brackets', + scope: [ + 'meta.brace.round.js', + 'meta.array-binding-pattern-variable.js', + 'meta.brace.square.js', + 'meta.brace.round.ts', + 'meta.array-binding-pattern-variable.ts', + 'meta.brace.square.ts', + 'meta.brace.round.tsx', + 'meta.array-binding-pattern-variable.tsx', + 'meta.brace.square.tsx', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation Accessor', + scope: [ + 'source.js punctuation.accessor', + 'source.ts punctuation.accessor', + 'source.tsx punctuation.accessor', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation Terminator Statement', + scope: [ + 'punctuation.terminator.statement.js', + 'punctuation.terminator.statement.ts', + 'punctuation.terminator.statement.tsx', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Array variables', + scope: [ + 'meta.array-binding-pattern-variable.js variable.other.readwrite.js', + 'meta.array-binding-pattern-variable.ts variable.other.readwrite.ts', + 'meta.array-binding-pattern-variable.tsx variable.other.readwrite.tsx', + ], + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Support Variables', + scope: [ + 'source.js support.variable', + 'source.ts support.variable', + 'source.tsx support.variable', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Support Variables', + scope: [ + 'variable.other.constant.property.js', + 'variable.other.constant.property.ts', + 'variable.other.constant.property.tsx', + ], + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Keyword New', + scope: ['keyword.operator.new.ts', 'keyword.operator.new.j', 'keyword.operator.new.tsx'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] TS Keyword Operator', + scope: ['source.ts keyword.operator', 'source.tsx keyword.operator'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Punctuation Parameter Separator', + scope: [ + 'punctuation.separator.parameter.js', + 'punctuation.separator.parameter.ts', + 'punctuation.separator.parameter.tsx ', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Import', + scope: ['constant.language.import-export-all.js', 'constant.language.import-export-all.ts'], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JSX/TSX Import', + scope: [ + 'constant.language.import-export-all.jsx', + 'constant.language.import-export-all.tsx', + ], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Keyword Control As', + scope: [ + 'keyword.control.as.js', + 'keyword.control.as.ts', + 'keyword.control.as.jsx', + 'keyword.control.as.tsx', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Variable Alias', + scope: [ + 'variable.other.readwrite.alias.js', + 'variable.other.readwrite.alias.ts', + 'variable.other.readwrite.alias.jsx', + 'variable.other.readwrite.alias.tsx', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Constants', + scope: [ + 'variable.other.constant.js', + 'variable.other.constant.ts', + 'variable.other.constant.jsx', + 'variable.other.constant.tsx', + ], + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Export Variable', + scope: [ + 'meta.export.default.js variable.other.readwrite.js', + 'meta.export.default.ts variable.other.readwrite.ts', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Template Strings Punctuation Accessor', + scope: [ + 'source.js meta.template.expression.js punctuation.accessor', + 'source.ts meta.template.expression.ts punctuation.accessor', + 'source.tsx meta.template.expression.tsx punctuation.accessor', + ], + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Import equals', + scope: [ + 'source.js meta.import-equals.external.js keyword.operator', + 'source.jsx meta.import-equals.external.jsx keyword.operator', + 'source.ts meta.import-equals.external.ts keyword.operator', + 'source.tsx meta.import-equals.external.tsx keyword.operator', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Type Module', + scope: + 'entity.name.type.module.js,entity.name.type.module.ts,entity.name.type.module.jsx,entity.name.type.module.tsx', + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Meta Class', + scope: 'meta.class.js,meta.class.ts,meta.class.jsx,meta.class.tsx', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Property Definition Variable', + scope: [ + 'meta.definition.property.js variable', + 'meta.definition.property.ts variable', + 'meta.definition.property.jsx variable', + 'meta.definition.property.tsx variable', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Meta Type Parameters Type', + scope: [ + 'meta.type.parameters.js support.type', + 'meta.type.parameters.jsx support.type', + 'meta.type.parameters.ts support.type', + 'meta.type.parameters.tsx support.type', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Meta Tag Keyword Operator', + scope: [ + 'source.js meta.tag.js keyword.operator', + 'source.jsx meta.tag.jsx keyword.operator', + 'source.ts meta.tag.ts keyword.operator', + 'source.tsx meta.tag.tsx keyword.operator', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Meta Tag Punctuation', + scope: [ + 'meta.tag.js punctuation.section.embedded', + 'meta.tag.jsx punctuation.section.embedded', + 'meta.tag.ts punctuation.section.embedded', + 'meta.tag.tsx punctuation.section.embedded', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Meta Array Literal Variable', + scope: [ + 'meta.array.literal.js variable', + 'meta.array.literal.jsx variable', + 'meta.array.literal.ts variable', + 'meta.array.literal.tsx variable', + ], + settings: { + foreground: '#C18401', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Module Exports', + scope: [ + 'support.type.object.module.js', + 'support.type.object.module.jsx', + 'support.type.object.module.ts', + 'support.type.object.module.tsx', + ], + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] JSON Constants', + scope: ['constant.language.json'], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Object Constants', + scope: [ + 'variable.other.constant.object.js', + 'variable.other.constant.object.jsx', + 'variable.other.constant.object.ts', + 'variable.other.constant.object.tsx', + ], + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Properties Keyword', + scope: [ + 'storage.type.property.js', + 'storage.type.property.jsx', + 'storage.type.property.ts', + 'storage.type.property.tsx', + ], + settings: { + foreground: '#0184BC', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Single Quote Inside Templated String', + scope: [ + 'meta.template.expression.js string.quoted punctuation.definition', + 'meta.template.expression.jsx string.quoted punctuation.definition', + 'meta.template.expression.ts string.quoted punctuation.definition', + 'meta.template.expression.tsx string.quoted punctuation.definition', + ], + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS Backtick inside Templated String', + scope: [ + 'meta.template.expression.js string.template punctuation.definition.string.template', + 'meta.template.expression.jsx string.template punctuation.definition.string.template', + 'meta.template.expression.ts string.template punctuation.definition.string.template', + 'meta.template.expression.tsx string.template punctuation.definition.string.template', + ], + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] JS/TS In Keyword for Loops', + scope: [ + 'keyword.operator.expression.in.js', + 'keyword.operator.expression.in.jsx', + 'keyword.operator.expression.in.ts', + 'keyword.operator.expression.in.tsx', + ], + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Constants Other', + scope: 'source.python constant.other', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Constants', + scope: 'source.python constant', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Placeholder Character', + scope: 'constant.character.format.placeholder.other.python storage', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Magic', + scope: 'support.variable.magic.python', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Meta Function Parameters', + scope: 'meta.function.parameters.python', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Function Separator Annotation', + scope: 'punctuation.separator.annotation.python', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Python Function Separator Punctuation', + scope: 'punctuation.separator.parameters.python', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Fields', + scope: 'entity.name.variable.field.cs', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Keyword Operators', + scope: 'source.cs keyword.operator', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Variables', + scope: 'variable.other.readwrite.cs', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Variables Other', + scope: 'variable.other.object.cs', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Property Other', + scope: 'variable.other.object.property.cs', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Property', + scope: 'entity.name.variable.property.cs', + settings: { + foreground: '#4078F2', + }, + }, + { + name: '[VSCODE-CUSTOM] CSharp Storage Type', + scope: 'storage.type.cs', + settings: { + foreground: '#C18401', + }, + }, + { + name: '[VSCODE-CUSTOM] Rust Unsafe Keyword', + scope: 'keyword.other.unsafe.rust', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Raw Block', + scope: 'markup.raw.block.markdown', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Shell Variables Punctuation Definition', + scope: 'punctuation.definition.variable.shell', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Css Support Constant Value', + scope: 'support.constant.property-value.css', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Css Punctuation Definition Constant', + scope: 'punctuation.definition.constant.css', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Sass Punctuation for key-value', + scope: 'punctuation.separator.key-value.scss', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Sass Punctuation for constants', + scope: 'punctuation.definition.constant.scss', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Sass Punctuation for key-value', + scope: 'meta.property-list.scss punctuation.separator.key-value.scss', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Java Storage Type Primitive Array', + scope: 'storage.type.primitive.array.java', + settings: { + foreground: '#C18401', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown headings', + scope: 'entity.name.section.markdown', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown heading Punctuation Definition', + scope: 'punctuation.definition.heading.markdown', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown heading setext', + scope: 'markup.heading.setext', + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Punctuation Definition Bold', + scope: 'punctuation.definition.bold.markdown', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Inline Raw', + scope: 'markup.inline.raw.markdown', + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown List Punctuation Definition', + scope: 'beginning.punctuation.definition.list.markdown', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Quote', + scope: 'markup.quote.markdown', + settings: { + foreground: '#A0A1A7', + fontStyle: 'italic', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Punctuation Definition String', + scope: [ + 'punctuation.definition.string.begin.markdown', + 'punctuation.definition.string.end.markdown', + 'punctuation.definition.metadata.markdown', + ], + settings: { + foreground: '#383A42', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Punctuation Definition Link', + scope: 'punctuation.definition.metadata.markdown', + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Underline Link/Image', + scope: ['markup.underline.link.markdown', 'markup.underline.link.image.markdown'], + settings: { + foreground: '#A626A4', + }, + }, + { + name: '[VSCODE-CUSTOM] Markdown Link Title/Description', + scope: ['string.other.link.title.markdown', 'string.other.link.description.markdown'], + settings: { + foreground: '#4078F2', + }, + }, + { + name: '[VSCODE-CUSTOM] Ruby Punctuation Separator Variable', + scope: 'punctuation.separator.variable.ruby', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] Ruby Other Constant Variable', + scope: 'variable.other.constant.ruby', + settings: { + foreground: '#986801', + }, + }, + { + name: '[VSCODE-CUSTOM] Ruby Keyword Operator Other', + scope: 'keyword.operator.other.ruby', + settings: { + foreground: '#50A14F', + }, + }, + { + name: '[VSCODE-CUSTOM] PHP Punctuation Variable Definition', + scope: 'punctuation.definition.variable.php', + settings: { + foreground: '#E45649', + }, + }, + { + name: '[VSCODE-CUSTOM] PHP Meta Class', + scope: 'meta.class.php', + settings: { + foreground: '#383A42', + }, + }, + ], colors: { 'editorLineNumber.foreground': '#CCCCCC', 'diffEditor.insertedTextBackground': '#ddfbe6', diff --git a/config/webpack.config.js b/config/webpack.config.js index 9ecae9790fd..7a6e6a4acd5 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -170,6 +170,11 @@ module.exports = { name: '[name].[hash:8].[ext]', }, }, + { + test: /\.wasm$/, + loader: 'file-loader', + type: 'javascript/auto', + }, ], }, diff --git a/package.json b/package.json index 64df2532977..329bda48f17 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,12 @@ "marked": "^0.3.12", "mermaid": "^8.0.0-rc.8", "monaco-editor": "^0.14.3", + "monaco-editor-textmate": "^2.0.1", "monaco-editor-webpack-plugin": "^1.5.4", + "monaco-textmate": "^3.0.0", + "monaco-textmate-languages": "^1.1.0", "mousetrap": "^1.4.6", + "onigasm": "^2.2.1", "pikaday": "^1.6.1", "popper.js": "^1.14.3", "prismjs": "^1.6.0", diff --git a/yarn.lock b/yarn.lock index 63a8913fa3d..5eaf4f7dcb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3543,6 +3543,11 @@ fast-levenshtein@~2.0.4: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-plist@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/fast-plist/-/fast-plist-0.1.2.tgz#a45aff345196006d406ca6cdcd05f69051ef35b8" + integrity sha1-pFr/NFGWAG1AbKbNzQX2kFHvNbg= + fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" @@ -5577,6 +5582,11 @@ moment@2.x, moment@^2.21.0: resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y= +monaco-editor-textmate@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/monaco-editor-textmate/-/monaco-editor-textmate-2.0.1.tgz#f33b4ddd89e0e47d6e364c7e1772bb7ea0c99c9f" + integrity sha512-0xFYTKtn5bSIVheegKpsqiPN/sxEX2ddGf876hSSFiOt/YIKIDt6ULFDmJGVIz4Mog3XqCY3++dFUgVqamjScg== + monaco-editor-webpack-plugin@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.5.4.tgz#6781a130e3e1379bb8f4cd190132f4af6dcd2c16" @@ -5587,6 +5597,18 @@ monaco-editor@^0.14.3: resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.14.3.tgz#7cc4a4096a3821f52fea9b10489b527ef3034e22" integrity sha512-RhaO4xXmWn/p0WrkEOXe4PoZj6xOcvDYjoAh0e1kGUrQnP1IOpc0m86Ceuaa2CLEMDINqKijBSmqhvBQnsPLHQ== +monaco-textmate-languages@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/monaco-textmate-languages/-/monaco-textmate-languages-1.1.0.tgz#61785ff1fc8a9a049398141ddb9b8e7bfbf3ab82" + integrity sha512-3vIEHIaifpp+tOXH3w1IGtKjSTnrET8AJNlbKKTiP162Z8JB3ic50zry4xRq+W6F8176NI0DyVMqDgCFD+OdBg== + +monaco-textmate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/monaco-textmate/-/monaco-textmate-3.0.0.tgz#abfbce7d7ff000954ae3206e512f325db6e7b8a8" + integrity sha512-llE/NasQkbAEDx/RPp0ili5ZEXH4e/UkYFMACvJrEY0aybq6FVW9qySt5C4kWwRXCJDL+4ewgoTt4XO3M+bfIg== + dependencies: + fast-plist "^0.1.2" + mousetrap@^1.4.6: version "1.4.6" resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.4.6.tgz#eaca72e22e56d5b769b7555873b688c3332e390a" @@ -5950,6 +5972,13 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +onigasm@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/onigasm/-/onigasm-2.2.1.tgz#d56da809d63d3bb25510e8b8e447ffe98e56bebb" + integrity sha512-pa361CpVfsWOk0MQ1jLuJ1GvEJMHEHgZmaBpOIfBbvbp2crkDHacXB6mA4vgEfO7fL0OEMUSuZjX0Q9yTx6jTg== + dependencies: + lru-cache "^4.1.1" + opencollective@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/opencollective/-/opencollective-1.0.3.tgz#aee6372bc28144583690c3ca8daecfc120dd0ef1" |