mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
ok figured out how to make the javascript autocomplete.
This commit is contained in:
parent
4497143785
commit
f02c6443cc
@ -1,6 +1,14 @@
|
||||
export const libSource = `interface NS {
|
||||
args: string[];
|
||||
/**
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
* Example documentation for scan.
|
||||
*/
|
||||
scan(ip: string, hostnames: boolean): string[];
|
||||
|
@ -202,6 +202,25 @@ export function Root(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function beforeMount(monaco: any): void {
|
||||
monaco.languages.registerCompletionItemProvider('javascript', {
|
||||
provideCompletionItems: () => {
|
||||
return { suggestions: [
|
||||
{
|
||||
label: 'upgradeHomeRam',
|
||||
kind: monaco.languages.CompletionItemKind.Function,
|
||||
insertText: 'upgradeHomeRam()',
|
||||
documentation: 'Hello javascript documentation',
|
||||
},
|
||||
{
|
||||
label: 'connect',
|
||||
kind: monaco.languages.CompletionItemKind.Function,
|
||||
insertText: 'connect(${1:server})',
|
||||
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
|
||||
documentation: 'Hello javascript documentation',
|
||||
},
|
||||
] };
|
||||
}
|
||||
});
|
||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
||||
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
||||
}
|
||||
@ -217,7 +236,7 @@ export function Root(props: IProps): React.ReactElement {
|
||||
onMount={onMount}
|
||||
loading={<p>Loading script editor!</p>}
|
||||
height="80%"
|
||||
defaultLanguage="typescript"
|
||||
defaultLanguage="javascript"
|
||||
defaultValue={code}
|
||||
value={code}
|
||||
onChange={updateCode}
|
||||
|
Loading…
Reference in New Issue
Block a user