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 () { (async function () {
// We have to improve the default js language otherwise theme sucks
const l = await monaco.languages const l = await monaco.languages
.getLanguages() .getLanguages()
.find((l: any) => l.id === "javascript") .find((l: any) => l.id === "javascript")
.loader(); .loader();
l.language.tokenizer.root.unshift(["ns", { token: "ns" }]); l.language.tokenizer.root.unshift(["ns", { token: "ns" }]);
for (const symbol of symbols) l.language.tokenizer.root.unshift(["\\." + symbol, { token: "netscriptfunction" }]); 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); console.log(l);
})(); })();

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