diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index e765f1757..b1fba5eaf 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -183,7 +183,7 @@ export async function determineAllPossibilitiesForTabCompletion( * has input ./partialexecutablename so autocomplete the script or program. * Put './' in front of each script/executable */ - if (isCommand("./") && index == -1) { + if (input.startsWith("./") && index == -1) { //All programs and scripts for (let i = 0; i < currServ.scripts.length; ++i) { allPos.push("./" + currServ.scripts[i].filename); @@ -193,6 +193,11 @@ export async function determineAllPossibilitiesForTabCompletion( for (let i = 0; i < homeComputer.programs.length; ++i) { allPos.push("./" + homeComputer.programs[i]); } + + //Contracts on current server + for (let i = 0; i < currServ.contracts.length; ++i) { + allPos.push("./" + currServ.contracts[i].fn) + } return allPos; } @@ -286,7 +291,8 @@ export async function determineAllPossibilitiesForTabCompletion( } async function scriptAutocomplete(): Promise { - if (!isCommand("run") && !isCommand("tail") && !isCommand("kill")) return; + if (!isCommand("run") && !isCommand("tail") && !isCommand("kill") && !input.startsWith("./")) return; + if (input.startsWith("./")) input = "run " + input.slice(2); const commands = ParseCommands(input); if (commands.length === 0) return; const command = ParseCommand(commands[commands.length - 1]);