mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-19 15:54:09 +02:00
merge dev
This commit is contained in:
@@ -41,10 +41,12 @@ export function OptionsModal(props: IProps): React.ReactElement {
|
||||
<Modal open={props.open} onClose={props.onClose}>
|
||||
<Box display="flex" flexDirection="row" alignItems="center">
|
||||
<Typography>Theme: </Typography>
|
||||
<Select onChange={(event) => setTheme(event.target.value)} defaultValue={props.options.theme}>
|
||||
<Select onChange={(event) => setTheme(event.target.value)} value={theme}>
|
||||
<MenuItem value="vs-dark">dark</MenuItem>
|
||||
<MenuItem value="light">light</MenuItem>
|
||||
<MenuItem value="monokai">monokai</MenuItem>
|
||||
<MenuItem value="solarized-dark">solarized-dark</MenuItem>
|
||||
<MenuItem value="solarized-light">solarized-light</MenuItem>
|
||||
</Select>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import * as monaco from "monaco-editor";
|
||||
type IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;
|
||||
import { OptionsModal } from "./OptionsModal";
|
||||
import { Options } from "./Options";
|
||||
import { js_beautify as beautifyCode } from "js-beautify";
|
||||
import { isValidFilePath } from "../../Terminal/DirectoryHelpers";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
@@ -217,12 +216,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
|
||||
function beautify(): void {
|
||||
if (editorRef.current === null) return;
|
||||
const pretty = beautifyCode(code, {
|
||||
indent_with_tabs: !options.insertSpaces,
|
||||
indent_size: 4,
|
||||
brace_style: "preserve-inline",
|
||||
});
|
||||
editorRef.current.setValue(pretty);
|
||||
editorRef.current.getAction("editor.action.formatDocument").run();
|
||||
}
|
||||
|
||||
function onFilenameChange(event: React.ChangeEvent<HTMLInputElement>): void {
|
||||
|
||||
@@ -63,4 +63,159 @@ export async function loadThemes(monaco: { editor: any }): Promise<void> {
|
||||
"editor.selectionHighlightBorder": "#222218",
|
||||
},
|
||||
});
|
||||
|
||||
monaco.editor.defineTheme("solarish-dark", {
|
||||
base: "vs-dark",
|
||||
inherit: true,
|
||||
rules: [
|
||||
{
|
||||
background: "002b36",
|
||||
token: "",
|
||||
},
|
||||
{
|
||||
foreground: "586e75",
|
||||
token: "comment",
|
||||
},
|
||||
{
|
||||
foreground: "00afaf",
|
||||
token: "string",
|
||||
},
|
||||
{
|
||||
token: "number",
|
||||
foreground: "00afaf",
|
||||
},
|
||||
{
|
||||
token: "otherkeyvars",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
foreground: "268bd2",
|
||||
token: "function",
|
||||
},
|
||||
{
|
||||
foreground: "859900",
|
||||
token: "keyword",
|
||||
},
|
||||
{
|
||||
token: "storage.type.function.js",
|
||||
foreground: "cb4b16",
|
||||
},
|
||||
{
|
||||
token: "ns",
|
||||
foreground: "cb4b16",
|
||||
},
|
||||
{
|
||||
token: "netscriptfunction",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
token: "otherkeywords",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
token: "type.identifier.js",
|
||||
foreground: "b58900",
|
||||
},
|
||||
{
|
||||
token: "delimiter.square.js",
|
||||
foreground: "0087ff",
|
||||
},
|
||||
{
|
||||
token: "delimiter.bracket.js",
|
||||
foreground: "0087ff",
|
||||
},
|
||||
{
|
||||
token: "this",
|
||||
foreground: "cb4b16",
|
||||
},
|
||||
],
|
||||
colors: {
|
||||
"editor.foreground": "#839496",
|
||||
"editor.background": "#002b36",
|
||||
"editor.selectionBackground": "#073642",
|
||||
"editor.lineHighlightBackground": "#073642",
|
||||
"editorCursor.foreground": "#819090",
|
||||
"editorWhitespace.foreground": "#073642",
|
||||
"editorIndentGuide.activeBackground": "#9D550FB0",
|
||||
"editor.selectionHighlightBorder": "#222218",
|
||||
},
|
||||
});
|
||||
|
||||
monaco.editor.defineTheme("solarish-light", {
|
||||
base: "vs",
|
||||
inherit: true,
|
||||
rules: [
|
||||
{
|
||||
foreground: "657b83",
|
||||
background: "fdf6e3",
|
||||
token: "",
|
||||
},
|
||||
{
|
||||
foreground: "586e75",
|
||||
token: "comment",
|
||||
},
|
||||
{
|
||||
foreground: "2aa198",
|
||||
token: "string",
|
||||
},
|
||||
{
|
||||
token: "number",
|
||||
foreground: "2aa198",
|
||||
},
|
||||
{
|
||||
token: "otherkeyvars",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
foreground: "268bd2",
|
||||
token: "function",
|
||||
},
|
||||
{
|
||||
foreground: "859900",
|
||||
token: "keyword",
|
||||
},
|
||||
{
|
||||
token: "storage.type.function.js",
|
||||
foreground: "bc4b16",
|
||||
},
|
||||
{
|
||||
token: "ns",
|
||||
foreground: "cb4b16",
|
||||
},
|
||||
{
|
||||
token: "netscriptfunction",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
token: "otherkeywords",
|
||||
foreground: "268bd2",
|
||||
},
|
||||
{
|
||||
token: "type.identifier.js",
|
||||
foreground: "b58900",
|
||||
},
|
||||
{
|
||||
token: "delimiter.square.js",
|
||||
foreground: "0087ff",
|
||||
},
|
||||
{
|
||||
token: "delimiter.bracket.js",
|
||||
foreground: "0087ff",
|
||||
},
|
||||
{
|
||||
token: "this",
|
||||
foreground: "cb4b16",
|
||||
},
|
||||
],
|
||||
colors: {
|
||||
"editor.foreground": "#657b83",
|
||||
"editor.background": "#fdf6e3",
|
||||
"editor.selectionBackground": "#eee8d5",
|
||||
"editor.lineHighlightBackground": "#eee8d5",
|
||||
"editorCursor.foreground": "#657b83",
|
||||
"editorWhitespace.foreground": "#eee8d5",
|
||||
"editorIndentGuide.activeBackground": "#eee8d5",
|
||||
"editor.selectionHighlightBorder": "#073642",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user