Merge pull request #1517 from danielyxie/dev

improve monokai again
This commit is contained in:
hydroflame 2021-10-15 18:58:55 -04:00 committed by GitHub
commit b6157e6851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -313,12 +313,18 @@ export function Root(props: IProps): React.ReactElement {
},
});
(async function () {
// We have to improve the default js language otherwise theme sucks
const l = await monaco.languages
.getLanguages()
.find((l: any) => l.id === "javascript")
.loader();
l.language.tokenizer.root.unshift(["ns", { token: "ns" }]);
for (const symbol of symbols) l.language.tokenizer.root.unshift(["\\." + symbol, { token: "netscriptfunction" }]);
const otherKeywords = ["let", "const", "var", "function"];
const otherKeyvars = ["true", "false", "null", "undefined"];
otherKeywords.forEach((k) => l.language.tokenizer.root.unshift([k, { token: "otherkeywords" }]));
otherKeyvars.forEach((k) => l.language.tokenizer.root.unshift([k, { token: "otherkeyvars" }]));
l.language.tokenizer.root.unshift(["this", { token: "this" }]);
console.log(l);
})();

@ -19,6 +19,10 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
token: "number",
foreground: "ae81ff",
},
{
token: "otherkeyvars",
foreground: "ae81ff",
},
{
foreground: "ae81ff",
token: "function",
@ -39,10 +43,14 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
token: "netscriptfunction",
foreground: "53d3e4",
},
// {
// foreground: "ae81ff",
// token: "entity.name.function",
// },
{
token: "otherkeywords",
foreground: "53d3e4",
},
{
token: "this",
foreground: "fd971f",
},
],
colors: {
"editor.foreground": "#F8F8F2",