浏览代码

EncodedTokensProvider works once theme data is loaded!

Michael Bolin 5 年之前
父节点
当前提交
d305813b6e
共有 3 个文件被更改,包括 338 次插入1 次删除
  1. 1 1
      src/app.ts
  2. 334 0
      src/dark_vs.ts
  3. 3 0
      src/index.ts

+ 1 - 1
src/app.ts

@@ -22,7 +22,7 @@ import {loadWASM} from 'onigasm';
 
 type GrammarConfiguration = {language: string; scopeName: string; url: string};
 
-const useEncodedTokens = false;
+const useEncodedTokens = true;
 main(useEncodedTokens, 'hack');
 
 const testOptions = {

+ 334 - 0
src/dark_vs.ts

@@ -0,0 +1,334 @@
+export default {
+  name: 'Dark Visual Studio',
+  settings: [
+    {
+      settings: {
+        foreground: '#D4D4D4',
+        background: '#1E1E1E',
+      },
+    },
+    {
+      scope: 'emphasis',
+      settings: {
+        fontStyle: 'italic',
+      },
+    },
+    {
+      scope: 'strong',
+      settings: {
+        fontStyle: 'bold',
+      },
+    },
+    {
+      scope: 'header',
+      settings: {
+        foreground: '#000080',
+      },
+    },
+
+    {
+      scope: 'comment',
+      settings: {
+        foreground: '#608b4e',
+      },
+    },
+    {
+      scope: 'constant.language',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'constant.numeric',
+      settings: {
+        foreground: '#b5cea8',
+      },
+    },
+    {
+      scope: 'constant.regexp',
+      settings: {
+        foreground: '#646695',
+      },
+    },
+    {
+      scope: [
+        'constant.other.color.rgb-value.css',
+        'constant.numeric.color.rgb-value.scss',
+        'constant.other.rgb-value.css',
+      ],
+      settings: {
+        foreground: '#d4d4d4',
+      },
+    },
+    {
+      scope: 'entity.name.tag',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'entity.name.tag.css',
+      settings: {
+        foreground: '#d7ba7d',
+      },
+    },
+    {
+      scope: 'entity.other.attribute-name',
+      settings: {
+        foreground: '#9cdcfe',
+      },
+    },
+    {
+      scope: [
+        'entity.other.attribute-name.class.css',
+        'entity.other.attribute-name.class.mixin.css',
+        'entity.other.attribute-name.id.css',
+        'entity.other.attribute-name.parent-selector.css',
+        'entity.other.attribute-name.pseudo-class.css',
+        'entity.other.attribute-name.pseudo-element.css',
+
+        'source.css.less entity.other.attribute-name.id',
+
+        'entity.other.attribute-name.attribute.scss',
+        'entity.other.attribute-name.scss',
+      ],
+      settings: {
+        foreground: '#d7ba7d',
+      },
+    },
+    {
+      scope: 'invalid',
+      settings: {
+        foreground: '#f44747',
+      },
+    },
+    {
+      scope: 'markup.underline',
+      settings: {
+        fontStyle: 'underline',
+      },
+    },
+    {
+      scope: 'markup.bold',
+      settings: {
+        fontStyle: 'bold',
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'markup.heading',
+      settings: {
+        fontStyle: 'bold',
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'markup.italic',
+      settings: {
+        fontStyle: 'italic',
+      },
+    },
+    {
+      scope: 'markup.inserted',
+      settings: {
+        foreground: '#b5cea8',
+      },
+    },
+    {
+      scope: 'markup.deleted',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'markup.changed',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'beginning.punctuation.definition.quote.markdown',
+      settings: {
+        foreground: '#608b4e',
+      },
+    },
+    {
+      scope: 'beginning.punctuation.definition.list.markdown',
+      settings: {
+        foreground: '#6796e6',
+      },
+    },
+    {
+      scope: 'markup.inline.raw',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'meta.selector',
+      settings: {
+        foreground: '#d7ba7d',
+      },
+    },
+    {
+      name: 'brackets of XML/HTML tags',
+      scope: 'punctuation.definition.tag',
+      settings: {
+        foreground: '#808080',
+      },
+    },
+    {
+      scope: 'meta.preprocessor',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'meta.preprocessor.string',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'meta.preprocessor.numeric',
+      settings: {
+        foreground: '#b5cea8',
+      },
+    },
+    {
+      scope: 'meta.structure.dictionary.key.python',
+      settings: {
+        foreground: '#9cdcfe',
+      },
+    },
+    {
+      scope: 'meta.diff.header',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'storage',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'storage.type',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'storage.modifier',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'string',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'string.tag',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'string.value',
+      settings: {
+        foreground: '#ce9178',
+      },
+    },
+    {
+      scope: 'string.regexp',
+      settings: {
+        foreground: '#d16969',
+      },
+    },
+    {
+      name: 'JavaScript string interpolation ${}',
+      scope: [
+        'punctuation.definition.template-expression.begin.ts',
+        'punctuation.definition.template-expression.end.ts',
+      ],
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'support.type.property-name',
+      settings: {
+        foreground: '#9cdcfe',
+      },
+    },
+    {
+      scope: 'keyword',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'keyword.control',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'keyword.operator',
+      settings: {
+        foreground: '#d4d4d4',
+      },
+    },
+    {
+      scope: ['keyword.operator.new', 'keyword.operator.expression'],
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'keyword.other.unit',
+      settings: {
+        foreground: '#b5cea8',
+      },
+    },
+    {
+      scope: [
+        'punctuation.section.embedded.metatag.begin.php',
+        'punctuation.section.embedded.metatag.end.php',
+      ],
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+    {
+      scope: 'support.function.git-rebase',
+      settings: {
+        foreground: '#9cdcfe',
+      },
+    },
+    {
+      scope: 'constant.sha.git-rebase',
+      settings: {
+        foreground: '#b5cea8',
+      },
+    },
+    {
+      name: 'coloring of the Java import and package identifiers',
+      scope: ['storage.modifier.import.java', 'storage.modifier.package.java'],
+      settings: {
+        foreground: '#d4d4d4',
+      },
+    },
+    {
+      name: 'this.self',
+      scope: 'variable.language',
+      settings: {
+        foreground: '#569cd6',
+      },
+    },
+  ],
+};

+ 3 - 0
src/index.ts

@@ -5,6 +5,8 @@ import {createOnigScanner, createOnigString, loadWASM} from 'vscode-oniguruma';
 import {INITIAL, Registry, parseRawGrammar} from 'vscode-textmate';
 type IState = monaco.languages.IState;
 
+import DEFAULT_THEME from './dark_vs';
+
 export async function createGrammarStore(
   scopeNameToTextMateGrammarURL: Map<string, string>,
 ): Promise<GrammarStore> {
@@ -109,6 +111,7 @@ async function createRegistry(
 
       throw Error(`request to ${url} failed: ${response}`);
     },
+    theme: DEFAULT_THEME,
   });
 }