feat(core): mix模式下使用diff去修改代码防止触发整个文件代码高亮的重新构建

This commit is contained in:
王立帮
2026-01-23 10:06:04 +08:00
parent 7fdd11b598
commit 51d5a286f7
31 changed files with 6378 additions and 46 deletions

View File

@@ -103,6 +103,10 @@
"path": "modules/web-modules/sortable.min.js",
"provide": ["Sortable"],
"require": []
}, {
"path": "modules/web-modules/diff.min.js",
"provide": ["Diff"],
"require": []
}, {
"path": "modules/web-modules/store.modern.min.js",
"provide": ["store"],

View File

@@ -1,7 +1,5 @@
goog.loadJs('common', () => {
goog.require('ace');
goog.require('ace.ExtLanguageTools');
goog.require('Mixly.Config');
goog.require('Mixly.XML');
goog.require('Mixly.Env');
@@ -11,6 +9,8 @@ goog.require('Mixly.Menu');
goog.require('Mixly.ContextMenu');
goog.require('Mixly.IdGenerator');
goog.require('Mixly.CodeFormatter');
goog.require('Mixly.MonacoTheme');
goog.require('Mixly.MonacoTreeSitter');
goog.require('Mixly.EditorMonaco');
goog.provide('Mixly.EditorCode');
@@ -24,12 +24,16 @@ const {
ContextMenu,
IdGenerator,
CodeFormatter,
MonacoTheme,
MonacoTreeSitter,
EditorMonaco
} = Mixly;
const { USER } = Config;
class EditorCode extends EditorMonaco {
#contextMenu_ = null;
#monacoTreeSitter_ = null;
constructor() {
super();
@@ -41,6 +45,7 @@ class EditorCode extends EditorMonaco {
this.setTabSize(4);
this.#addContextMenu_();
this.setTheme(USER.theme);
this.#monacoTreeSitter_ = new MonacoTreeSitter(this);
}
onMounted() {
@@ -113,40 +118,65 @@ class EditorCode extends EditorMonaco {
setValue(data, ext) {
this.disableChangeEvent();
super.setValue(data, ext);
super.setValue(data);
const language = this.getLanguageByExt(ext);
if (MonacoTheme.supportThemes.includes(language)) {
this.setTheme(`${USER.theme}-${language}`);
} else {
this.setTheme(USER.theme);
}
this.setLanguage(language);
this.enableChangeEvent();
CodeFormatter.activateFormatter(language)
.then((formatter) => {
const menu = this.#contextMenu_.getItem('code');
if (!formatter) {
menu.remove('sep-format');
menu.remove('format');
return;
this.setCodeFormatter(language, ext).catch(Debug.error);
}
diffEdits(data, ext) {
this.disableChangeEvent();
super.diffEdits(data);
const language = this.getLanguageByExt(ext);
this.setLanguage(language);
if (MonacoTheme.supportThemes.includes(language)) {
this.setTheme(`${USER.theme}-${language}`);
} else {
this.setTheme(USER.theme);
}
this.#monacoTreeSitter_.setValue(language, USER.theme, data);
this.enableChangeEvent();
this.setCodeFormatter(language, ext).catch(Debug.error);
}
async setCodeFormatter(language, ext) {
const formatter = await CodeFormatter.activateFormatter(language);
const menu = this.#contextMenu_.getItem('code');
if (!formatter) {
menu.remove('sep-format');
menu.remove('format');
return;
}
menu.add({
weight: 6,
id: 'sep-format',
data: '---------'
});
menu.add({
weight: 6,
id: 'format',
data: {
isHtmlName: true,
name: Menu.getItem(Msg.Lang['editor.contextMenu.formatDocument'], ''),
callback: () => {
CodeFormatter.format(language, this.getValue())
.then((data) => {
super.setValue(data, ext);
})
.catch(Debug.error);
}
menu.add({
weight: 6,
id: 'sep-format',
data: '---------'
});
menu.add({
weight: 6,
id: 'format',
data: {
isHtmlName: true,
name: Menu.getItem(Msg.Lang['editor.contextMenu.formatDocument'], ''),
callback: (key, opt) => {
CodeFormatter.format(language, this.getValue())
.then((data) => {
super.setValue(data, ext);
})
.catch(Debug.error);
}
}
});
})
.catch(Debug.error);
}
});
}
getTreeSitter() {
return this.#monacoTreeSitter_;
}
getLanguageByExt(ext) {
@@ -183,7 +213,10 @@ class EditorCode extends EditorMonaco {
#addChangeEventListenerExt_() {
this.offEvent('change');
this.bind('change', () => this.addDirty());
this.bind('change', () => {
this.addDirty();
this.#monacoTreeSitter_.setValue(this.getLanguage(), USER.theme, this.getValue());
});
}
dispose() {

View File

@@ -39,7 +39,7 @@ const {
HTMLTemplate,
LayerExt
} = Mixly;
const { BOARD, SOFTWARE } = Config;
const { BOARD, SOFTWARE, USER } = Config;
const { form } = layui;
@@ -173,6 +173,7 @@ class EditorMix extends EditorBase {
codePage.offEvent('change');
codePage.bind('change', () => {
this.addDirty();
codePage.getTreeSitter().setValue(codePage.getLanguage(), USER.theme, codePage.getValue());
});
}
@@ -217,12 +218,12 @@ class EditorMix extends EditorBase {
&& typeof this.py2BlockEditor.updateBlock === 'function') {
this.py2BlockEditor.updateBlock();
} else {
codePage.setValue(blockPage.getValue(), this.#language_);
codePage.diffEdits(blockPage.getValue(), this.#language_);
}
break;
case Drag.Extend.POSITIVE:
this.#temp_ = blockPage.getValue();
codePage.setValue(this.#temp_, this.#language_);
codePage.diffEdits(this.#temp_, this.#language_);
break;
}
blockPage.resize();
@@ -363,7 +364,7 @@ class EditorMix extends EditorBase {
return;
}
this.#temp_ = code;
codePage.setValue(code, this.#language_);
codePage.diffEdits(code, this.#language_);
});
this.#addCodeChangeEventListener_();
}
@@ -549,7 +550,7 @@ class EditorMix extends EditorBase {
return;
}
this.drag.full(Drag.Extend.NEGATIVE); // 完全显示代码编辑器
codePage.setValue(code, this.#language_);
codePage.diffEdits(code, this.#language_);
endFunc('USE_CODE');
return;
}
@@ -585,7 +586,7 @@ class EditorMix extends EditorBase {
Blockly.hideChaff();
if (!useIncompleteBlocks && codeDom && xmlDom.attr('shown') === 'code') {
this.drag.full(Drag.Extend.NEGATIVE); // 完全显示代码编辑器
codePage.setValue(code, this.#language_);
codePage.diffEdits(code, this.#language_);
endFunc();
return;
}

View File

@@ -1,5 +1,6 @@
goog.loadJs('common', () => {
goog.require('Diff');
goog.require('monaco');
goog.require('Mixly.XML');
goog.require('Mixly.Env');
@@ -70,8 +71,8 @@ class EditorMonaco extends EditorBase {
}
});
editor.onDidChangeModelContent(() => {
this.events.run('change');
editor.onDidChangeModelContent((...args) => {
this.events.run('change', ...args);
});
}
@@ -121,6 +122,7 @@ class EditorMonaco extends EditorBase {
#state_ = null;
#tabSize_ = null;
#language_ = null;
#mode_ = null;
constructor() {
super();
@@ -132,6 +134,7 @@ class EditorMonaco extends EditorBase {
init() {
super.init();
this.#editor_ = monaco.editor.createModel('');
this.#editor_.setEOL(monaco.editor.EndOfLineSequence.LF);
}
onMounted() {
@@ -187,13 +190,21 @@ class EditorMonaco extends EditorBase {
}
setTheme(mode) {
if (this.#mode_ === mode) {
return;
}
const editor = EditorMonaco.getEditor();
editor.updateOptions({
theme: `vs-${mode}`
});
this.#mode_ = mode;
}
setValue(data, ext) {
getTheme() {
return this.#mode_;
}
setValue(data) {
if (this.getValue() === data) {
return;
}
@@ -209,6 +220,72 @@ class EditorMonaco extends EditorBase {
return this.#editor_.getValue();
}
diffEdits(data) {
const prevData = this.getValue();
if (prevData === data) {
return;
}
const edits = this.buildDiffEdits(prevData, data);
if (!edits.length) {
return;
}
this.#editor_.pushEditOperations([], edits, () => null);
}
buildDiffEdits(prevData, nextData) {
if (prevData === nextData) {
return [];
}
const diffs = Diff.diffChars(prevData, nextData);
const edits = [];
const state = {
index: 0,
pendingStart: null,
pendingText: ''
};
for (const d of diffs) {
if (d.added) {
if (state.pendingStart == null) {
state.pendingStart = state.index;
}
state.pendingText += d.value;
}
else if (d.removed) {
if (state.pendingStart == null) {
state.pendingStart = state.index;
}
state.index += d.value.length;
}
else {
this.flushPendingEdit(state, edits);
state.index += d.value.length;
}
}
this.flushPendingEdit(state, edits);
return edits;
}
flushPendingEdit(state, edits) {
const { pendingStart, index, pendingText } = state;
if (pendingStart == null) {
return;
}
const startPos = this.#editor_.getPositionAt(pendingStart);
const endPos = this.#editor_.getPositionAt(index);
edits.push({
range: new monaco.Range(
startPos.lineNumber,
startPos.column,
endPos.lineNumber,
endPos.column
),
text: pendingText,
forceMoveMarkers: true
});
state.pendingStart = null;
state.pendingText = '';
}
clear() {
this.setValue('', true);
}
@@ -242,7 +319,7 @@ class EditorMonaco extends EditorBase {
let selection = editor.getSelection();
let selectedText = this.#editor_.getValueInRange(selection);
if (selection) {
editor.executeEdits("cut", [{ range: selection, text: '' }]);
editor.executeEdits('cut', [{ range: selection, text: '' }]);
navigator.clipboard.writeText(selectedText);
}
this.focus();
@@ -281,6 +358,10 @@ class EditorMonaco extends EditorBase {
monaco.editor.setModelLanguage(this.#editor_, language);
}
getLanguage() {
return this.#language_;
}
setTabSize(tabSize) {
if (this.#tabSize_ === tabSize) {
return;

View File

@@ -0,0 +1,119 @@
goog.loadJs('common', () => {
goog.require('monaco');
goog.require('Mixly.Registry');
goog.provide('Mixly.MonacoTheme');
const { Registry } = Mixly;
class MonacoTheme {
static {
this.cssClassNamePrefix = 'mts';
this.themesRegistry = new Registry();
this.supportThemes = [];
// this.supportThemes = ['cpp', 'python'];
this.getClassNameOfTerm = function (type, theme, term) {
return `${this.cssClassNamePrefix}-${type}-${theme}-${term}`;
}
/*this.themesRegistry.register('vs-dark-cpp', new MonacoTheme(
'vs-dark-cpp',
'cpp',
'dark',
goog.readJsonSync('../common/templates/json/tree-sitter/themes/dark-cpp.json')
));
this.themesRegistry.register('vs-light-cpp', new MonacoTheme(
'vs-light-cpp',
'cpp',
'light',
goog.readJsonSync('../common/templates/json/tree-sitter/themes/light-cpp.json')
));
this.themesRegistry.register('vs-dark-python', new MonacoTheme(
'vs-dark-python',
'python',
'dark',
goog.readJsonSync('../common/templates/json/tree-sitter/themes/dark-python.json')
));
this.themesRegistry.register('vs-light-python', new MonacoTheme(
'vs-light-python',
'python',
'light',
goog.readJsonSync('../common/templates/json/tree-sitter/themes/light-python.json')
));*/
}
#id_ = null;
#type_ = null;
#theme_ = null;
#$tag_ = null;
#config_ = null;
constructor(id, type, theme, config) {
this.#id_ = id;
this.#type_ = type;
this.#theme_ = theme;
this.load(config);
}
load(config) {
monaco.editor.defineTheme(this.#id_, config.base);
this.#config_ = config;
if (!this.#$tag_) {
let hasStyleNode = $('head').find(`style[style-id='${this.id_}']`).length;
if (hasStyleNode) {
return;
}
this.#$tag_ = $('<style></style>');
this.#$tag_.attr('style-id', this.id);
this.#$tag_.attr('type', 'text/css')
$('head').append(this.#$tag_);
}
this.#$tag_.html(this.generateCss());
}
generateCss() {
return Object.keys(this.#config_.monacoTreeSitter)
.map(term =>
`span.${MonacoTheme.getClassNameOfTerm(this.#type_, this.#theme_, term)}{${this.generateStyleOfTerm(term)}}`
)
.join('');
}
generateStyleOfTerm(term) {
const style = this.#config_.monacoTreeSitter[term];
if (!style) {
return '';
}
if (typeof style === 'string') {
return `color:${style}`;
}
return `color:${style.color};${style.extraCssStyles || ''}`;
}
getColorOfTerm(term) {
const style = this.#config_.monacoTreeSitter[term];
if (!style) {
return undefined;
}
return typeof style === 'object' ? style.color : style;
}
dispose() {
this.#$tag_ && this.#$tag_.remove();
this.#$tag_ = null;
this.#config_ = null;
}
}
Mixly.MonacoTheme = MonacoTheme;
});

View File

@@ -0,0 +1,127 @@
goog.loadJs('common', () => {
goog.require('_');
goog.require('monaco');
goog.require('Mixly.Registry');
goog.require('Mixly.MonacoTheme');
goog.provide('Mixly.MonacoTreeSitter');
const { Registry, MonacoTheme } = Mixly;
class MonacoTreeSitter {
static {
this.workerPath = '../common/modules/mixly-modules/workers/common/tree-sitter/index.js';
this.supportTreeSitters_ = new Registry();
this.activeTreeSitters_ = new Registry();
/*this.supportTreeSitters_.register('python', {
workerName: 'pythonTreeSitterService',
wasm: 'tree-sitter-python.wasm'
});
this.supportTreeSitters_.register('cpp', {
workerName: 'cppTreeSitterService',
wasm: 'tree-sitter-cpp.wasm'
});*/
this.activateTreeSitter = async function (type) {
if (!this.supportTreeSitters_.hasKey(type)) return null;
const info = this.supportTreeSitters_.getItem(type);
if (this.activeTreeSitters_.hasKey(type)) {
const ts = this.activeTreeSitters_.getItem(type);
if (ts.loading) await ts.loading;
return ts;
}
const treeSitter = workerpool.pool(this.workerPath, {
workerOpts: { name: info.workerName },
workerType: 'web'
});
const grammar = await goog.readJson(
`../common/templates/json/tree-sitter/grammars/${type}.json`
);
treeSitter.loading = treeSitter.exec(
'init',
[info.wasm, grammar]
);
this.activeTreeSitters_.register(type, treeSitter);
await treeSitter.loading;
treeSitter.loading = null;
return treeSitter;
};
this.treeSitterPostion = function (pos) {
return {
row: pos.lineNumber - 1,
column: pos.column - 1
};
};
}
constructor(editor, opts) {
this.editor = editor;
this.seq = 0;
this.decorations = [];
this.refresh = _.debounce(
this.refresh.bind(this),
opts?.debounceUpdate ?? 15
);
}
dispose() {
this.pool.terminate(true);
this.decorations = [];
}
async updateWorker(type, theme, text) {
const treeSitter = await MonacoTreeSitter.activateTreeSitter(type);
if (!treeSitter) {
return;
}
const id = ++this.seq;
const dto = await treeSitter.exec('update', [text]);
if (id !== this.seq) return;
this.applyDecorations(type, theme, dto);
}
applyDecorations(type, theme, dto) {
const decos = [];
for (const [term, ranges] of Object.entries(dto)) {
const className = MonacoTheme.getClassNameOfTerm(type, theme, term);
for (const r of ranges) {
decos.push({
range: new monaco.Range(
r.startLineNumber,
r.startColumn,
r.endLineNumber,
r.endColumn
),
options: {
inlineClassName: className
}
});
}
}
this.decorations = this.editor.getEditor().deltaDecorations(this.decorations, decos);
}
refresh(type, theme, newText) {
this.updateWorker(type, theme, newText);
}
setValue(type, theme, newText) {
this.refresh(type, theme, newText);
}
}
Mixly.MonacoTreeSitter = MonacoTreeSitter;
});

View File

@@ -9,6 +9,7 @@ goog.require('Mixly.Debug');
goog.require('Mixly.Config');
goog.require('Mixly.StatusBar');
goog.require('Mixly.SideBarsManager');
goog.require('Mixly.RightSideBarsManager');
goog.require('Mixly.HTMLTemplate');
goog.require('Mixly.PageBase');
goog.require('Mixly.Menu');

View File

@@ -60,7 +60,7 @@ class StatusBar extends EditorAce {
} else {
editor.setOption('theme', 'ace/theme/xcode');
}
editor.getSession().setMode("ace/mode/python");
editor.getSession().setMode('ace/mode/python');
editor.setReadOnly(true);
// editor.setScrollSpeed(0.3);
editor.setShowPrintMargin(false);

View File

@@ -286,8 +286,6 @@
{
"path": "/common/editor-code.js",
"require": [
"ace",
"ace.ExtLanguageTools",
"Mixly.Config",
"Mixly.XML",
"Mixly.Env",
@@ -297,6 +295,8 @@
"Mixly.ContextMenu",
"Mixly.IdGenerator",
"Mixly.CodeFormatter",
"Mixly.MonacoTheme",
"Mixly.MonacoTreeSitter",
"Mixly.EditorMonaco"
],
"provide": [
@@ -351,6 +351,7 @@
{
"path": "/common/editor-monaco.js",
"require": [
"Diff",
"monaco",
"Mixly.XML",
"Mixly.Env",
@@ -778,6 +779,28 @@
"Mixly.MJson"
]
},
{
"path": "/common/monaco-theme.js",
"require": [
"monaco",
"Mixly.Registry"
],
"provide": [
"Mixly.MonacoTheme"
]
},
{
"path": "/common/monaco-tree-sitter.js",
"require": [
"_",
"monaco",
"Mixly.Registry",
"Mixly.MonacoTheme"
],
"provide": [
"Mixly.MonacoTreeSitter"
]
},
{
"path": "/common/msg.js",
"require": [
@@ -1115,6 +1138,7 @@
"Mixly.Config",
"Mixly.StatusBar",
"Mixly.SideBarsManager",
"Mixly.RightSideBarsManager",
"Mixly.HTMLTemplate",
"Mixly.PageBase",
"Mixly.Menu",

View File

@@ -0,0 +1,141 @@
importScripts('./tree-sitter.js');
importScripts('../../../../web-modules/workerpool.min.js');
const terms = [
'type',
'scope',
'function',
'variable',
'number',
'string',
'comment',
'constant',
'directive',
'control',
'operator',
'modifier',
'punctuation'
];
let parser;
let tree = null;
let language = null;
class Language {
constructor(grammarJson) {
this.simpleTerms = {};
this.complexTerms = [];
this.complexScopes = {};
for (const t in grammarJson.simpleTerms)
this.simpleTerms[t] = grammarJson.simpleTerms[t];
for (const t in grammarJson.complexTerms)
this.complexTerms[t] = grammarJson.complexTerms[t];
for (const t in grammarJson.complexScopes)
this.complexScopes[t] = grammarJson.complexScopes[t];
this.complexDepth = 0;
this.complexOrder = false;
for (const s in this.complexScopes) {
const depth = s.split('>').length;
if (depth > this.complexDepth)
this.complexDepth = depth;
if (s.indexOf('[') >= 0)
this.complexOrder = true;
}
this.complexDepth--;
}
}
async function init(languageWasmPath, grammarJson) {
await TreeSitter.init();
parser = new TreeSitter();
const lang = await TreeSitter.Language.load(languageWasmPath);
console.log(lang.version)
parser.setLanguage(lang);
language = new Language(grammarJson);
tree = null;
}
function buildDecorations(tree) {
const result = [];
const stack = [];
let node = tree.rootNode.firstChild;
while (stack.length > 0 || node) {
if (node) {
stack.push(node);
node = node.firstChild;
}
else {
node = stack.pop();
let type = node.type;
if (!node.isNamed())
type = '"' + type + '"';
let term = null;
if (!language.complexTerms.includes(type)) {
term = language.simpleTerms[type];
}
else {
let desc = type;
let scopes = [desc];
let parent = node.parent;
for (let i = 0; i < language.complexDepth && parent; i++) {
let parentType = parent.type;
if (!parent.isNamed())
parentType = '"' + parentType + '"';
desc = parentType + ' > ' + desc;
scopes.push(desc);
parent = parent.parent;
}
if (language.complexOrder) {
let index = 0;
let sibling = node.previousSibling;
while (sibling) {
if (sibling.type === node.type)
index++;
sibling = sibling.previousSibling;
}
let rindex = -1;
sibling = node.nextSibling;
while (sibling) {
if (sibling.type === node.type)
rindex--;
sibling = sibling.nextSibling;
}
const orderScopes = [];
for (let i = 0; i < scopes.length; i++)
orderScopes.push(scopes[i], scopes[i] + '[' + index + ']', scopes[i] + '[' + rindex + ']');
scopes = orderScopes;
}
for (const d of scopes)
if (d in language.complexScopes)
term = language.complexScopes[d];
}
if (terms.includes(term)) {
if (!result[term]) {
result[term] = [];
}
result[term].push({
startLineNumber: node.startPosition.row + 1,
startColumn: node.startPosition.column + 1,
endLineNumber: node.endPosition.row + 1,
endColumn: node.endPosition.column + 1
});
}
node = node.nextSibling;
}
}
return result;
}
function update(text) {
const tree = parser.parse(text);
return buildDecorations(tree);
}
workerpool.worker({
init,
update
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,123 @@
{
"simpleTerms": {
"type_identifier": "type",
"primitive_type": "type",
"\"signed\"": "type",
"\"unsigned\"": "type",
"\"short\"": "type",
"\"long\"": "type",
"statement_identifier": "variable",
"\"const\"": "modifier",
"\"static\"": "modifier",
"\"auto\"": "modifier",
"\"extern\"": "modifier",
"\"inline\"": "modifier",
"\"register\"": "modifier",
"\"volatile\"": "modifier",
"\"restrict\"": "modifier",
"\"_Atomic\"": "modifier",
"\"__attribute__\"": "modifier",
"function_specifier": "modifier",
"number_literal": "number",
"char_literal": "string",
"string_literal": "string",
"system_lib_string": "string",
"escape_sequence": "string",
"comment": "comment",
"null": "constant",
"true": "constant",
"false": "constant",
"\"if\"": "control",
"\"else\"": "control",
"\"do\"": "control",
"\"for\"": "control",
"\"while\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"return\"": "control",
"\"switch\"": "control",
"\"case\"": "control",
"\"default\"": "control",
"\"goto\"": "control",
"\"struct\"": "control",
"\"enum\"": "control",
"\"union\"": "control",
"\"typedef\"": "control",
"\"sizeof\"": "operator",
"\".\"": "operator",
"\"->\"": "operator",
"\"*\"": "operator",
"\"-\"": "operator",
"\"+\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"==\"": "operator",
"\"!\"": "operator",
"\"!=\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"&\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\"?\"": "operator",
"\":\"": "operator",
"\"#if\"": "directive",
"\"#ifdef\"": "directive",
"\"#ifndef\"": "directive",
"\"#elif\"": "directive",
"\"#else\"": "directive",
"\"#endif\"": "directive",
"\"#define\"": "directive",
"\"#include\"": "directive",
"preproc_directive": "directive",
"preproc_arg": "directive",
"\";\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\",\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation"
},
"complexTerms": ["identifier", "field_identifier"],
"complexScopes": {
"identifier": "variable",
"field_identifier": "variable",
"call_expression > identifier" : "function",
"call_expression > field_expression > field_identifier" : "function",
"function_declarator > identifier" : "function"
}
}

View File

@@ -0,0 +1,156 @@
{
"simpleTerms": {
"type_identifier": "type",
"primitive_type": "type",
"\"unsigned\"": "type",
"\"signed\"": "type",
"\"short\"": "type",
"\"long\"": "type",
"auto": "type",
"namespace_identifier": "scope",
"operator_name": "function",
"\"public\"": "modifier",
"\"protected\"": "modifier",
"\"private\"": "modifier",
"\"virtual\"": "modifier",
"\"override\"": "modifier",
"\"default\"": "modifier",
"\"final\"": "modifier",
"\"const\"": "modifier",
"\"constexpr\"": "modifier",
"\"static\"": "modifier",
"\"extern\"": "modifier",
"\"inline\"": "modifier",
"\"noexcept\"": "modifier",
"\"explicit\"": "modifier",
"\"friend\"": "modifier",
"\"register\"": "modifier",
"\"volatile\"": "modifier",
"\"restrict\"": "modifier",
"\"_Atomic\"": "modifier",
"\"__attribute__\"": "modifier",
"function_specifier": "modifier",
"number_literal": "number",
"char_literal": "string",
"string_literal": "string",
"system_lib_string": "string",
"raw_string_literal": "string",
"escape_sequence": "string",
"comment": "comment",
"null": "constant",
"nullptr": "constant",
"true": "constant",
"false": "constant",
"\"if\"": "control",
"\"else\"": "control",
"\"do\"": "control",
"\"for\"": "control",
"\"while\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"return\"": "control",
"\"switch\"": "control",
"\"case\"": "control",
"\"goto\"": "control",
"\"struct\"": "control",
"\"enum\"": "control",
"\"union\"": "control",
"\"typedef\"": "control",
"\"class\"": "control",
"\"using\"": "control",
"\"namespace\"": "control",
"\"template\"": "control",
"\"typename\"": "control",
"\"try\"": "control",
"\"catch\"": "control",
"\"throw\"": "control",
"\"sizeof\"": "operator",
"\"new\"": "operator",
"\".\"": "operator",
"\"->\"": "operator",
"\"*\"": "operator",
"\"-\"": "operator",
"\"+\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"==\"": "operator",
"\"!\"": "operator",
"\"!=\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"&\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\"?\"": "operator",
"\"::\"": "operator",
"\"#if\"": "directive",
"\"#ifdef\"": "directive",
"\"#ifndef\"": "directive",
"\"#elif\"": "directive",
"\"#else\"": "directive",
"\"#endif\"": "directive",
"\"#define\"": "directive",
"\"#include\"": "directive",
"preproc_directive": "directive",
"\";\"": "punctuation",
"\":\"": "punctuation",
"\",\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation"
},
"complexTerms": ["identifier", "field_identifier", "\"delete\""],
"complexScopes": {
"identifier": "variable",
"field_identifier": "variable",
"call_expression > identifier": "function",
"call_expression > field_expression > field_identifier": "function",
"call_expression > scoped_identifier > identifier": "function",
"template_function > identifier": "function",
"template_function > scoped_identifier > identifier": "function",
"template_method > field_identifier": "function",
"function_declarator > identifier": "function",
"function_declarator > field_identifier": "function",
"function_declarator > scoped_identifier > identifier": "function",
"destructor_name > identifier": "function",
"\"delete\"": "operator",
"delete_method_clause > \"delete\"": "modifier"
}
}

View File

@@ -0,0 +1,108 @@
{
"simpleTerms": {
"type_identifier": "type",
"package_identifier": "scope",
"\"var\"": "modifier",
"\"const\"": "modifier",
"interpreted_string_literal": "string",
"raw_string_literal": "string",
"escape_sequence": "string",
"rune_literal": "number",
"int_literal": "number",
"float_literal": "number",
"imaginary_literal": "number",
"comment": "comment",
"nil": "constant",
"false": "constant",
"true": "constant",
"\"if\"": "control",
"\"for\"": "control",
"\"else\"": "control",
"\"case\"": "control",
"\"break\"": "control",
"\"switch\"": "control",
"\"select\"": "control",
"\"return\"": "control",
"\"default\"": "control",
"\"continue\"": "control",
"\"goto\"": "control",
"\"fallthrough\"": "control",
"\"defer\"": "control",
"\"range\"": "control",
"\"go\"": "control",
"\"type\"": "operator",
"\"struct\"": "operator",
"\"import\"": "operator",
"\"package\"": "operator",
"\"func\"": "operator",
"\"interface\"": "operator",
"\"map\"": "operator",
"\"chan\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"==\"": "operator",
"\"!=\"": "operator",
"\">\"": "operator",
"\"<\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"!\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\":=\"": "operator",
"\"&\"": "operator",
"\"&&\"": "operator",
"\"&^\"": "operator",
"\"&^=\"": "operator",
"\"||\"": "operator",
"\"...\"": "operator",
"\"<-\"": "operator",
"\"[\"": "operator",
"\"]\"": "operator",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\",\"": "punctuation",
"\";\"": "punctuation",
"\".\"": "punctuation",
"\":\"": "punctuation"
},
"complexTerms": ["identifier", "field_identifier"],
"complexScopes": {
"identifier": "variable",
"field_identifier": "variable",
"call_expression > identifier": "function",
"function_declaration > identifier": "function",
"method_declaration > field_identifier": "function",
"call_expression > selector_expression > field_identifier": "function"
}
}

View File

@@ -0,0 +1,136 @@
{
"simpleTerms": {
"shorthand_property_identifier": "variable",
"\"var\"": "modifier",
"\"let\"": "modifier",
"\"extends\"": "modifier",
"\"const\"": "modifier",
"\"static\"": "modifier",
"number": "number",
"string": "string",
"escape_sequence": "string",
"template_string": "string",
"regex": "string",
"comment": "comment",
"hash_bang_line": "comment",
"true": "constant",
"false": "constant",
"null": "constant",
"undefined": "constant",
"\"as\"": "control",
"\"if\"": "control",
"\"do\"": "control",
"\"else\"": "control",
"\"while\"": "control",
"\"for\"": "control",
"\"return\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"throw\"": "control",
"\"try\"": "control",
"\"catch\"": "control",
"\"finally\"": "control",
"\"switch\"": "control",
"\"case\"": "control",
"\"default\"": "control",
"\"export\"": "control",
"\"import\"": "control",
"\"from\"": "control",
"\"yield\"": "control",
"\"async\"": "control",
"\"await\"": "control",
"\"debugger\"": "control",
"\"delete\"": "control",
"this": "operator",
"\"class\"": "operator",
"\"function\"": "operator",
"\"in\"": "operator",
"\"instanceof\"": "operator",
"\"of\"": "operator",
"\"new\"": "operator",
"\"typeof\"": "operator",
"\"get\"": "operator",
"\"set\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\">>>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\"!\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"==\"": "operator",
"\"===\"": "operator",
"\"!=\"": "operator",
"\"!==\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"=>\"": "operator",
"\">\"": "operator",
"\"<\"": "operator",
"\":\"": "operator",
"\"?\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"&\"": "operator",
"\"~\"": "operator",
"\"^\"": "operator",
"\">>\"": "operator",
"\">>>\"": "operator",
"\"<<\"": "operator",
"\"|\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"...\"": "operator",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\";\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\".\"": "punctuation",
"\",\"": "punctuation",
"\"${\"": "punctuation"
},
"complexTerms": ["identifier", "field_identifier", "property_identifier", "super"],
"complexScopes": {
"identifier": "variable",
"property_identifier": "variable",
"formal_parameters > identifier": "variable",
"jsx_attribute > property_identifier": "variable",
"class > identifier": "type",
"new_expression > identifier": "type",
"jsx_opening_element > identifier": "type",
"jsx_closing_element > identifier": "type",
"jsx_self_closing_element > identifier": "type",
"call_expression > identifier": "function",
"call_expression > super": "function",
"function > identifier": "function",
"generator_function > identifier": "function",
"method_definition > property_identifier": "function",
"call_expression > member_expression > property_identifier": "function"
}
}

View File

@@ -0,0 +1,87 @@
{
"simpleTerms": {
"method": "function",
"\"local\"": "modifier",
"\"function\"": "modifier",
"number": "number",
"string": "string",
"comment": "comment",
"true": "constant",
"false": "constant",
"nil": "constant",
"global_variable": "constant",
"\"while\"": "control",
"\"do\"": "control",
"\"until\"": "control",
"\"break\"": "control",
"\"for\"": "control",
"\"if\"": "control",
"\"else\"": "control",
"\"elseif\"": "control",
"\"then\"": "control",
"\"end\"": "control",
"\"goto\"": "control",
"\"repeat\"": "control",
"\"return\"": "control",
"self": "operator",
"\"and\"": "operator",
"\"or\"": "operator",
"\"not\"": "operator",
"\"in\"": "operator",
"\"next\"": "operator",
"\"spread\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"^\"": "operator",
"\"#\"": "operator",
"\"&\"": "operator",
"\"~\"": "operator",
"\"|\"": "operator",
"\"//\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"==\"": "operator",
"\"~=\"": "operator",
"\"<=\"": "operator",
"\">=\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\"=\"": "operator",
"\"::\"": "operator",
"\":\"": "operator",
"\".\"": "operator",
"\"..\"": "operator",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\";\"": "punctuation",
"\",\"": "punctuation"
},
"complexTerms": ["identifier", "property_identifier"],
"complexScopes": {
"identifier": "variable",
"property_identifier": "variable",
"function_call > identifier": "function",
"function_call > property_identifier": "function",
"function_name > identifier": "function",
"function_name > property_identifier": "function",
"local_function > identifier": "function"
}
}

View File

@@ -0,0 +1,164 @@
{
"simpleTerms": {
"variable_name": "variable",
"__construct": "function",
"\"echo\"": "function",
"\"print\"": "function",
"\"unset\"": "function",
"\"isset\"": "function",
"\"eval\"": "function",
"\"array\"": "function",
"\"list\"": "function",
"\"empty\"": "function",
"require_once": "function",
"require": "function",
"include_once": "function",
"include": "function",
"\"callable\"": "modifier",
"\"var\"": "modifier",
"\"trait\"": "modifier",
"\"class\"": "modifier",
"\"interface\"": "modifier",
"\"function\"": "modifier",
"\"type\"": "modifier",
"\"static\"": "modifier",
"\"public\"": "modifier",
"\"private\"": "modifier",
"\"protected\"": "modifier",
"\"global\"": "modifier",
"\"const\"": "modifier",
"\"abstract\"": "modifier",
"\"extends\"": "modifier",
"\"implements\"": "modifier",
"\"final\"": "modifier",
"integer": "number",
"float": "number",
"string": "string",
"regex": "string",
"true": "constant",
"false": "constant",
"comment": "comment",
"\"if\"": "control",
"\"do\"": "control",
"\"else\"": "control",
"\"elseif\"": "control",
"\"endif\"": "control",
"\"while\"": "control",
"\"endwhile\"": "control",
"\"for\"": "control",
"\"endfor\"": "control",
"\"foreach\"": "control",
"\"endforeach\"": "control",
"\"declare\"": "control",
"\"enddeclare\"": "control",
"\"return\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"throw\"": "control",
"\"try\"": "control",
"\"catch\"": "control",
"\"finally\"": "control",
"\"switch\"": "control",
"\"endswitch\"": "control",
"\"case\"": "control",
"\"default\"": "control",
"\"yield\"": "control",
"\"goto\"": "control",
"\"exit\"": "control",
"\"die\"": "control",
"\"new\"": "operator",
"\"clone\"": "operator",
"\"insteadof\"": "operator",
"\"instanceof\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"**\"": "operator",
"\"=\"": "operator",
"\"==\"": "operator",
"\"===\"": "operator",
"\"!=\"": "operator",
"\"!==\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\"<>\"": "operator",
"\"<=\"": "operator",
"\"=>\"": "operator",
"\">=\"": "operator",
"\"<=>\"": "operator",
"\"&\"": "operator",
"\"$\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"and\"": "operator",
"\"or\"": "operator",
"\"xor\"": "operator",
"\"!\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\".\"": "operator",
"\"?\"": "operator",
"\":\"": "operator",
"\"??\"": "operator",
"\"->\"": "operator",
"\"as\"": "operator",
"\"use\"": "directive",
"\"namespace\"": "directive",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\";\"": "punctuation",
"\",\"": "punctuation"
},
"complexTerms": ["name", "simple_variable"],
"complexScopes": {
"class_declaration > name": "type",
"catch_clause > qualified_name > name": "type",
"class_base_clause > qualified_name > name": "type",
"interface_declaration > name": "type",
"class_interface_clause > qualified_name > name": "type",
"object_creation_expression > qualified_name > name": "type",
"cast_expression > cast_type": "type",
"object_creation_expression > new_variable > simple_variable": "type",
"name": "variable",
"member_access_expression > name": "variable",
"function_definition > name": "function",
"function_call_expression > name": "function",
"function_call_expression > qualified_name": "function",
"method_declaration > name": "function",
"method_declaration > function_definition > name": "function",
"scoped_call_expression > name": "function",
"member_call_expression > name": "function",
"const_element > name": "constant",
"class_constant_access_expression > name": "constant",
"qualified_name > name": "constant"
}
}

View File

@@ -0,0 +1,117 @@
{
"simpleTerms": {
"module": "scope",
"\"global\"": "modifier",
"\"nonlocal\"": "modifier",
"decorator": "function",
"\"print\"": "function",
"\"assert\"": "function",
"\"exec\"": "function",
"\"del\"": "function",
"integer" : "number",
"float" : "number",
"string": "string",
"escape_sequence": "string",
"interpolation": "string",
"comment": "comment",
"none": "constant",
"true": "constant",
"false": "constant",
"\"if\"": "control",
"\"else\"": "control",
"\"elif\"": "control",
"\"while\"": "control",
"\"for\"": "control",
"\"return\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"pass\"": "control",
"\"raise\"": "control",
"\"yield\"": "control",
"\"await\"": "control",
"\"async\"": "control",
"\"try\"": "control",
"\"except\"": "control",
"\"with\"": "control",
"\"as\"": "control",
"\"finally\"": "control",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"@\"": "operator",
"\"**\"": "operator",
"\"//\"": "operator",
"\"==\"": "operator",
"\"!=\"": "operator",
"\"<>\"": "operator",
"\">\"": "operator",
"\"<\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"@=\"": "operator",
"\"**=\"": "operator",
"\"//=\"": "operator",
"\"&\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"in\"": "operator",
"\"and\"": "operator",
"\"or\"": "operator",
"\"not\"": "operator",
"\"is\"": "operator",
"\"import\"": "directive",
"\"from\"": "directive",
"\"class\"": "directive",
"\"def\"": "directive",
"\"lambda\"": "directive",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation"
},
"complexTerms": ["identifier", "attribute"],
"complexScopes": {
"type > identifier": "type",
"class_definition > identifier": "type",
"class_definition > argument_list > attribute": "type",
"class_definition > argument_list > identifier": "type",
"class_definition > argument_list > keyword_argument > attribute": "type",
"class_definition > argument_list > keyword_argument > identifier": "type",
"identifier": "variable",
"attribute > identifier": "variable",
"keyword_argument > identifier": "variable",
"default_parameter > identifier": "variable",
"parameters > identifier": "variable",
"parameters > list_splat > identifier": "variable",
"parameters > dictionary_splat > identifier": "variable",
"call > identifier": "function",
"call > attribute > identifier[-1]": "function",
"function_definition > identifier": "function"
}
}

View File

@@ -0,0 +1,117 @@
{
"simpleTerms": {
"constant": "type",
"class_variable": "variable",
"instance_variable": "variable",
"string": "string",
"bare_string": "string",
"subshell": "string",
"heredoc_beginning": "string",
"heredoc_body": "string",
"regex": "string",
"escape_sequence": "string",
"symbol": "string",
"bare_symbol": "string",
"interpolation": "string",
"float": "number",
"integer": "number",
"complex": "number",
"rational": "number",
"comment": "comment",
"nil": "constant",
"true": "constant",
"false": "constant",
"\"if\"": "control",
"\"unless\"": "control",
"\"def\"": "control",
"\"do\"": "control",
"\"end\"": "control",
"\"else\"": "control",
"\"elsif\"": "control",
"\"class\"": "control",
"\"module\"": "control",
"\"alias\"": "control",
"\"begin\"": "control",
"\"rescue\"": "control",
"\"ensure\"": "control",
"\"return\"": "control",
"\"yield\"": "control",
"\"case\"": "control",
"\"when\"": "control",
"\"then\"": "control",
"\"for\"": "control",
"\"break\"": "control",
"\"next\"": "control",
"\"retry\"": "control",
"\"while\"": "control",
"\"in\"": "control",
"\"until\"": "control",
"self": "control",
"super": "control",
"\"and\"": "operator",
"\"or\"": "operator",
"\"not\"": "operator",
"\"||\"": "operator",
"\"&&\"": "operator",
"\"!\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"=\"": "operator",
"\"==\"": "operator",
"\"!=\"": "operator",
"\"===\"": "operator",
"\"<=>\"": "operator",
"\"=~\"": "operator",
"\"!~\"": "operator",
"\"<\"": "operator",
"\"<=\"": "operator",
"\">\"": "operator",
"\">=\"": "operator",
"\"&\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"*\"": "operator",
"\"**\"": "operator",
"\"+@\"": "operator",
"\"-@\"": "operator",
"\"..\"": "operator",
"\"[]\"": "operator",
"\"[]=\"": "operator",
"\"defined?\"": "operator",
"\",\"": "punctuation",
"\"%w(\"": "punctuation",
"\"%i(\"": "punctuation",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"#{\"": "punctuation"
},
"complexTerms": ["identifier"],
"complexScopes": {
"identifier": "variable",
"block_parameters > identifier": "variable",
"keyword_parameter > identifier": "constant",
"method > identifier": "function",
"setter > identifier": "function",
"call > identifier": "function",
"method_call > identifier": "function",
"singleton_method > identifier": "function",
"method_parameters > identifier": "function"
},
}

View File

@@ -0,0 +1,168 @@
{
"simpleTerms": {
"primitive_type": "type",
"inner_attribute_item": "variable",
"shorthand_field_identifier": "variable",
"\"_\"": "variable",
"boolean_literal": "number",
"integer_literal": "number",
"float_literal": "number",
"char_literal": "string",
"string_literal": "string",
"raw_string_literal": "string",
"escape_sequence": "string",
"line_comment": "comment",
"block_comment": "comment",
"\"let\"": "modifier",
"\"const\"": "modifier",
"\"static\"": "modifier",
"\"extern\"": "modifier",
"\"dyn\"": "modifier",
"\"trait\"": "modifier",
"\"mod\"": "modifier",
"\"pub\"": "modifier",
"\"default\"": "modifier",
"\"ref\"": "modifier",
"mutable_specifier": "modifier",
"\"fn\"": "control",
"\"type\"": "control",
"\"struct\"": "control",
"\"enum\"": "control",
"\"union\"": "control",
"\"impl\"": "control",
"\"unsafe\"": "control",
"\"match\"": "control",
"\"if\"": "control",
"\"in\"": "control",
"\"else\"": "control",
"\"move\"": "control",
"\"while\"": "control",
"\"loop\"": "control",
"\"for\"": "control",
"\"return\"": "control",
"\"continue\"": "control",
"\"break\"": "control",
"\"where\"": "control",
"\"macro_rules!\"": "control",
"self": "control",
"super": "control",
"crate": "control",
"\".\"": "operator",
"\"->\"": "operator",
"\"=>\"": "operator",
"\"-\"": "operator",
"\"+\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"==\"": "operator",
"\"!\"": "operator",
"\"!=\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"&\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\"?\"": "operator",
"\"::\"": "operator",
"\"..\"": "operator",
"\"as\"": "operator",
"\"use\"": "directive",
"\"#\"": "directive",
"\";\"": "punctuation",
"\":\"": "punctuation",
"\",\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation"
},
"complexTerms": [
"identifier", "field_identifier", "type_identifier",
"\"(\"", "\")\"", "\"[\"", "\"]\"", "\"*\""],
"complexScopes": {
"type_identifier": "type",
"scoped_type_identifier > type_identifier": "type",
"use_declaration > identifier": "type",
"use_declaration > scoped_identifier > identifier[-1]": "type",
"use_list > identifier": "type",
"use_list > scoped_identifier > identifier": "type",
"use_wildcard > \"*\"": "type",
"use_as_clause > identifier": "type",
"tuple_struct_pattern > identifier": "type",
"tuple_struct_pattern > scoped_identifier > identifier[-1]": "type",
"enum_variant > identifier": "type",
"match_pattern > scoped_identifier > identifier[-1]": "type",
"unit_type > \"(\"": "type",
"unit_type > \")\"": "type",
"scoped_identifier > identifier": "scope",
"scoped_type_identifier > identifier": "scope",
"scoped_type_identifier > scoped_identifier > identifier": "scope",
"scoped_identifier > scoped_identifier > identifier": "scope",
"scoped_use_list > scoped_identifier > identifier": "scope",
"scoped_use_list > identifier": "scope",
"use_wildcard > scoped_identifier > identifier": "scope",
"use_wildcard > identifier": "scope",
"struct_pattern > scoped_type_identifier > identifier": "scope",
"struct_expression > scoped_type_identifier > identifier": "scope",
"identifier": "variable",
"field_identifier": "variable",
"scoped_identifier > identifier[-1]": "variable",
"call_expression > identifier": "function",
"call_expression > field_expression > field_identifier[-1]": "function",
"call_expression > scoped_identifier > identifier[-1]": "function",
"macro_invocation > identifier": "function",
"macro_definition > identifier": "function",
"generic_function > identifier": "function",
"generic_function > field_expression > field_identifier": "function",
"generic_function > scoped_identifier > identifier": "function",
"function_item > identifier": "function",
"function_signature_item > identifier": "function",
"lifetime > identifier": "modifier",
"meta_item > identifier": "directive",
"\"*\"": "operator",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"unit_expression > \"(\"": "constant",
"unit_expression > \")\"": "constant",
"attribute_item > \"[\"": "directive",
"attribute_item > \"]\"": "directive"
}
}

View File

@@ -0,0 +1,156 @@
{
"simpleTerms": {
"type_identifier": "type",
"predefined_type": "type",
"namespace": "scope",
"\"module\"": "scope",
"shorthand_property_identifier": "variable",
"\"var\"": "modifier",
"\"let\"": "modifier",
"\"extends\"": "modifier",
"\"const\"": "modifier",
"\"static\"": "modifier",
"\"public\"": "modifier",
"\"private\"": "modifier",
"\"protected\"": "modifier",
"\"readonly\"": "modifier",
"number": "number",
"string": "string",
"escape_sequence": "string",
"template_string": "string",
"template_substitution": "string",
"regex": "string",
"comment": "comment",
"hash_bang_line": "comment",
"true": "constant",
"false": "constant",
"null": "constant",
"undefined": "constant",
"\"as\"": "control",
"\"if\"": "control",
"\"do\"": "control",
"\"else\"": "control",
"\"while\"": "control",
"\"for\"": "control",
"\"return\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"throw\"": "control",
"\"try\"": "control",
"\"catch\"": "control",
"\"finally\"": "control",
"\"switch\"": "control",
"\"case\"": "control",
"\"default\"": "control",
"\"export\"": "control",
"\"import\"": "control",
"\"from\"": "control",
"\"yield\"": "control",
"\"async\"": "control",
"\"await\"": "control",
"\"debugger\"": "control",
"this": "operator",
"\"class\"": "operator",
"\"type\"": "operator",
"\"enum\"": "operator",
"\"function\"": "operator",
"\"interface\"": "operator",
"\"implements\"": "operator",
"\"declare\"": "operator",
"\"in\"": "operator",
"\"instanceof\"": "operator",
"\"of\"": "operator",
"\"new\"": "operator",
"\"delete\"": "operator",
"\"typeof\"": "operator",
"\"get\"": "operator",
"\"set\"": "operator",
"\"=\"": "operator",
"\"+=\"": "operator",
"\"-=\"": "operator",
"\"*=\"": "operator",
"\"/=\"": "operator",
"\"%=\"": "operator",
"\"<<=\"": "operator",
"\">>=\"": "operator",
"\">>>=\"": "operator",
"\"&=\"": "operator",
"\"^=\"": "operator",
"\"|=\"": "operator",
"\"!\"": "operator",
"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"==\"": "operator",
"\"===\"": "operator",
"\"!=\"": "operator",
"\"!==\"": "operator",
"\">=\"": "operator",
"\"<=\"": "operator",
"\"=>\"": "operator",
"\">\"": "operator",
"\"<\"": "operator",
"\":\"": "operator",
"\"?\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\"&\"": "operator",
"\"~\"": "operator",
"\"^\"": "operator",
"\">>\"": "operator",
"\">>>\"": "operator",
"\"<<\"": "operator",
"\"|\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"...\"": "operator",
"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\";\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\".\"": "punctuation",
"\",\"": "punctuation",
"\"${\"": "punctuation"
},
"complexTerms": ["identifier", "property_identifier", "super"],
"complexScopes": {
"class > identifier": "type",
"new_expression > call_expression > identifier": "type",
"jsx_opening_element > identifier": "type",
"jsx_closing_element > identifier": "type",
"jsx_self_closing_element > identifier": "type",
"nested_type_identifier > identifier": "scope",
"identifier": "variable",
"property_identifier": "variable",
"member_expression > property_identifier": "variable",
"jsx_attribute > property_identifier": "variable",
"call_expression > identifier": "function",
"call_expression > super": "function",
"function > identifier": "function",
"generator_function > identifier": "function",
"method_definition > property_identifier": "function",
"call_expression > member_expression > property_identifier": "function",
"method_signature > property_identifier": "function",
"function_signature > identifier": "function"
}
}

View File

@@ -0,0 +1,124 @@
{
"monacoTreeSitter": {
"type": "#4EC9B0",
"scope": "#D4D4D4",
"function": "#E5C07B",
"variable": "#9CDCFE",
"number": "#B5CEA8",
"string": "#D19A66",
"comment": "#5C6370",
"constant": "#56B6C2",
"directive": "#C586C0",
"control": "#569CD6",
"operator": "#D4D4D4",
"modifier": "#569CD6",
"punctuation": "#D4D4D4"
},
"base": {
"base": "vs-dark",
"inherit": true,
"rules": [
{
"token": "comment",
"foreground": "5C6370",
"fontStyle": "italic"
},
{
"token": "keyword",
"foreground": "569CD6",
"fontStyle": "bold"
},
{
"token": "keyword.control",
"foreground": "569CD6",
"fontStyle": "bold"
},
{
"token": "storage",
"foreground": "569CD6",
"fontStyle": "bold"
},
{
"token": "storage.type",
"foreground": "569CD6",
"fontStyle": "bold"
},
{
"token": "entity.name.type",
"foreground": "4EC9B0"
},
{
"token": "support.type",
"foreground": "4EC9B0"
},
{
"token": "entity.name.function",
"foreground": "E5C07B",
"fontStyle": "bold"
},
{
"token": "support.function",
"foreground": "E5C07B",
"fontStyle": "bold"
},
{
"token": "meta.function-call",
"foreground": "E5C07B",
"fontStyle": "bold"
},
{
"token": "variable",
"foreground": "9CDCFE"
},
{
"token": "variable.parameter",
"foreground": "9CDCFE"
},
{
"token": "constant.numeric",
"foreground": "B5CEA8"
},
{
"token": "constant.language",
"foreground": "56B6C2",
"fontStyle": "bold"
},
{
"token": "support.constant",
"foreground": "56B6C2",
"fontStyle": "bold"
},
{
"token": "string",
"foreground": "D19A66"
},
{
"token": "meta.preprocessor",
"foreground": "C586C0",
"fontStyle": "bold"
},
{
"token": "keyword.control.directive",
"foreground": "C586C0",
"fontStyle": "bold"
},
{
"token": "operator",
"foreground": "D4D4D4"
},
{
"token": "invalid",
"foreground": "FFFFFF",
"background": "F44747"
}
],
"colors": {
"editor.foreground": "#D4D4D4",
"editor.background": "#1E1E1E",
"editor.selectionBackground": "#2C313A",
"editor.lineHighlightBackground": "#2A2D2E",
"editorCursor.foreground": "#AEAFAD",
"editorWhitespace.foreground": "#404040"
}
}
}

View File

@@ -0,0 +1,116 @@
{
"monacoTreeSitter": {
"type": "#0ca1a6",
"scope": "#dae3e3",
"function": "#F39C12",
"variable": "#dae3e3",
"number": "#7fcbcd",
"string": "#7fcbcd",
"comment": "#7f8c8d",
"constant": "#7fcbcd",
"directive": "#C586C0",
"control": "#0ca1a6",
"operator": "#dae3e3",
"modifier": "#0ca1a6",
"punctuation": "#dae3e3"
},
"base": {
"base": "vs-dark",
"inherit": true,
"rules": [
{
"token": "comment",
"foreground": "7f8c8d"
},
{
"token": "keyword",
"foreground": "0ca1a6"
},
{
"token": "keyword.control",
"foreground": "0ca1a6"
},
{
"token": "storage",
"foreground": "0ca1a6"
},
{
"token": "storage.type",
"foreground": "0ca1a6"
},
{
"token": "entity.name.type",
"foreground": "7fcbcd"
},
{
"token": "support.type",
"foreground": "7fcbcd"
},
{
"token": "entity.name.function",
"foreground": "F39C12"
},
{
"token": "support.function",
"foreground": "F39C12"
},
{
"token": "meta.function-call",
"foreground": "F39C12"
},
{
"token": "variable",
"foreground": "dae3e3"
},
{
"token": "variable.parameter",
"foreground": "dae3e3"
},
{
"token": "constant.numeric",
"foreground": "7fcbcd"
},
{
"token": "constant.language",
"foreground": "7fcbcd"
},
{
"token": "support.constant",
"foreground": "7fcbcd"
},
{
"token": "string",
"foreground": "7fcbcd"
},
{
"token": "meta.preprocessor",
"foreground": "C586C0"
},
{
"token": "keyword.control.directive",
"foreground": "C586C0"
},
{
"token": "operator",
"foreground": "dae3e3"
},
{
"token": "punctuation",
"foreground": "dae3e3"
},
{
"token": "invalid",
"foreground": "ffffff",
"background": "df7365"
}
],
"colors": {
"editor.background": "#1f272a",
"editor.foreground": "#dae3e3",
"editor.selectionBackground": "#00818480",
"editor.lineHighlightBackground": "#434f5410",
"editorCursor.foreground": "#dae3e3",
"editorWhitespace.foreground": "#374146"
}
}
}

View File

@@ -0,0 +1,113 @@
{
"monacoTreeSitter": {
"type": "#005C5F",
"scope": "#4e5b61",
"function": "#D35400",
"variable": "#4e5b61",
"number": "#005C5F",
"string": "#005C5F",
"comment": "#95a5a6cc",
"constant": "#005C5F",
"directive": "#728E00",
"control": "#00979D",
"operator": "#4e5b61",
"modifier": "#00979D",
"punctuation": "#4e5b61"
},
"base": {
"base": "vs",
"inherit": true,
"rules": [
{
"token": "comment",
"foreground": "95a5a6"
},
{
"token": "keyword",
"foreground": "00979D"
},
{
"token": "keyword.control",
"foreground": "00979D"
},
{
"token": "storage",
"foreground": "00979D"
},
{
"token": "storage.type",
"foreground": "005C5F"
},
{
"token": "entity.name.type",
"foreground": "005C5F"
},
{
"token": "support.type",
"foreground": "005C5F"
},
{
"token": "entity.name.function",
"foreground": "D35400"
},
{
"token": "support.function",
"foreground": "D35400"
},
{
"token": "meta.function-call",
"foreground": "D35400"
},
{
"token": "variable",
"foreground": "4e5b61"
},
{
"token": "variable.parameter",
"foreground": "4e5b61"
},
{
"token": "constant.numeric",
"foreground": "005C5F"
},
{
"token": "constant.language",
"foreground": "005C5F",
"fontStyle": "bold"
},
{
"token": "support.constant",
"foreground": "005C5F"
},
{
"token": "string",
"foreground": "005C5F"
},
{
"token": "meta.preprocessor",
"foreground": "728E00"
},
{
"token": "keyword.control.directive",
"foreground": "728E00"
},
{
"token": "operator",
"foreground": "4e5b61"
},
{
"token": "invalid",
"foreground": "ffffff",
"background": "df7365"
}
],
"colors": {
"editor.foreground": "#4e5b61",
"editor.background": "#ffffff",
"editor.selectionBackground": "#7fcbcdb3",
"editor.lineHighlightBackground": "#434f5410",
"editorCursor.foreground": "#4e5b61",
"editorWhitespace.foreground": "#bfbfbf"
}
}
}

View File

@@ -0,0 +1,104 @@
{
"monacoTreeSitter": {
"type": "#267F99",
"scope": "#333333",
"function": "#795E26",
"variable": "#333333",
"number": "#098658",
"string": "#A31515",
"comment": "#008000",
"constant": "#0451A5",
"directive": "#AF00DB",
"control": "#AF00DB",
"operator": "#333333",
"modifier": "#AF00DB",
"punctuation": "#333333"
},
"base": {
"base": "vs",
"inherit": true,
"rules": [
{
"token": "comment",
"foreground": "008000"
},
{
"token": "keyword",
"foreground": "AF00DB"
},
{
"token": "keyword.control",
"foreground": "AF00DB"
},
{
"token": "entity.name.class",
"foreground": "267F99"
},
{
"token": "entity.name.type",
"foreground": "267F99"
},
{
"token": "entity.name.function",
"foreground": "795E26"
},
{
"token": "support.function.builtin",
"foreground": "0451A5"
},
{
"token": "variable.parameter",
"foreground": "001080"
},
{
"token": "variable.language.self",
"foreground": "001080"
},
{
"token": "entity.name.function.magic",
"foreground": "001080"
},
{
"token": "meta.decorator",
"foreground": "AF00DB"
},
{
"token": "string",
"foreground": "A31515"
},
{
"token": "string.doc",
"foreground": "008000"
},
{
"token": "constant.numeric",
"foreground": "098658"
},
{
"token": "constant.language",
"foreground": "0451A5"
},
{
"token": "punctuation",
"foreground": "333333"
},
{
"token": "keyword.operator",
"foreground": "333333"
},
{
"token": "invalid",
"foreground": "FFFFFF",
"background": "E51400"
}
],
"colors": {
"editor.background": "#FFFFFF",
"editor.foreground": "#333333",
"editor.selectionBackground": "#ADD6FF",
"editor.lineHighlightBackground": "#FFFFFF",
"editorCursor.foreground": "#000000",
"editorWhitespace.foreground": "#BFBFBF"
}
}
}