mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 04:35:46 +01:00
EDITOR: Add file URI's to monaco to improve intellisense (#1017)
This commit is contained in:
parent
7e721c144e
commit
68a8427838
@ -1,5 +1,5 @@
|
|||||||
import type { ContentFilePath } from "../../Paths/ContentFile";
|
import type { ContentFilePath } from "../../Paths/ContentFile";
|
||||||
import { editor, Position } from "monaco-editor";
|
import monaco, { editor, Position } from "monaco-editor";
|
||||||
|
|
||||||
type ITextModel = editor.ITextModel;
|
type ITextModel = editor.ITextModel;
|
||||||
|
|
||||||
@ -24,6 +24,13 @@ export class OpenScript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
regenerateModel(): void {
|
regenerateModel(): void {
|
||||||
this.model = editor.createModel(this.code, this.isTxt ? "plaintext" : "javascript");
|
this.model = editor.createModel(
|
||||||
|
this.code,
|
||||||
|
this.isTxt ? "plaintext" : "javascript",
|
||||||
|
monaco.Uri.from({
|
||||||
|
scheme: "file",
|
||||||
|
path: `${this.hostname}/${this.path}`,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,14 @@ function Root(props: IProps): React.ReactElement {
|
|||||||
code,
|
code,
|
||||||
props.hostname,
|
props.hostname,
|
||||||
new monaco.Position(0, 0),
|
new monaco.Position(0, 0),
|
||||||
monaco.editor.createModel(code, filename.endsWith(".txt") ? "plaintext" : "javascript"),
|
monaco.editor.createModel(
|
||||||
|
code,
|
||||||
|
filename.endsWith(".txt") ? "plaintext" : "javascript",
|
||||||
|
monaco.Uri.from({
|
||||||
|
scheme: "file",
|
||||||
|
path: `${props.hostname}/${filename}`,
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
openScripts.push(newScript);
|
openScripts.push(newScript);
|
||||||
currentScript = newScript;
|
currentScript = newScript;
|
||||||
|
Loading…
Reference in New Issue
Block a user