From a780880531a62a9ff87fb2ed02cecdb86873f35b Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Fri, 14 Jun 2024 13:56:27 +0700 Subject: [PATCH] MISC: Add ns.enums to AutocompleteData (#1389) --- markdown/bitburner.autocompletedata.enums.md | 11 +++++++++++ markdown/bitburner.autocompletedata.md | 1 + src/ScriptEditor/NetscriptDefinitions.d.ts | 1 + src/Terminal/getTabCompletionPossibilities.ts | 2 ++ 4 files changed, 15 insertions(+) create mode 100644 markdown/bitburner.autocompletedata.enums.md diff --git a/markdown/bitburner.autocompletedata.enums.md b/markdown/bitburner.autocompletedata.enums.md new file mode 100644 index 000000000..9621a894c --- /dev/null +++ b/markdown/bitburner.autocompletedata.enums.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [AutocompleteData](./bitburner.autocompletedata.md) > [enums](./bitburner.autocompletedata.enums.md) + +## AutocompleteData.enums property + +**Signature:** + +```typescript +enums: NSEnums; +``` diff --git a/markdown/bitburner.autocompletedata.md b/markdown/bitburner.autocompletedata.md index 444e79449..4c55ea495 100644 --- a/markdown/bitburner.autocompletedata.md +++ b/markdown/bitburner.autocompletedata.md @@ -16,6 +16,7 @@ interface AutocompleteData | Property | Modifiers | Type | Description | | --- | --- | --- | --- | +| [enums](./bitburner.autocompletedata.enums.md) | | [NSEnums](./bitburner.nsenums.md) | | | [scripts](./bitburner.autocompletedata.scripts.md) | | string\[\] | | | [servers](./bitburner.autocompletedata.servers.md) | | string\[\] | | | [txts](./bitburner.autocompletedata.txts.md) | | string\[\] | | diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 4a7d9bbe6..a4c038203 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -8770,6 +8770,7 @@ interface AutocompleteData { servers: string[]; scripts: string[]; txts: string[]; + enums: NSEnums; flags(schema: [string, string | number | boolean | string[]][]): { [key: string]: ScriptArg | string[] }; } diff --git a/src/Terminal/getTabCompletionPossibilities.ts b/src/Terminal/getTabCompletionPossibilities.ts index 223b59fb8..5b6f88ef6 100644 --- a/src/Terminal/getTabCompletionPossibilities.ts +++ b/src/Terminal/getTabCompletionPossibilities.ts @@ -10,6 +10,7 @@ import { AutocompleteData } from "@nsdefs"; import libarg from "arg"; import { getAllDirectories, resolveDirectory, root } from "../Paths/Directory"; import { resolveScriptFilePath } from "../Paths/ScriptFilePath"; +import { enums } from "../NetscriptFunctions"; // TODO: this shouldn't be hardcoded in two places with no typechecks to verify equivalence // An array of all Terminal commands @@ -324,6 +325,7 @@ export async function getTabCompletionPossibilities(terminalText: string, baseDi .map((server) => server.hostname), scripts: [...currServ.scripts.keys()], txts: [...currServ.textFiles.keys()], + enums: enums, flags: (schema: unknown) => { if (!Array.isArray(schema)) throw new Error("flags require an array of array"); pos2 = schema.map((f: unknown) => {