Skip to content

Commit

Permalink
Add missing semicolons, fix ansi-regex causing failed activation
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyBot committed Feb 1, 2022
1 parent 851f881 commit d002ca6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions src/commands/cli-parsing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const PREFIX = "Uc&42BWAaQ";
import { output } from '../extension';
const ansiRegex = require('ansi-regex');
/**
* Finds the logging message that contains the error message.
*
Expand All @@ -25,7 +24,10 @@ export const parseMakeOutput = (stdout: any) => {
for (let err of errorSplit) {
if(err.substr(PREFIX.length).startsWith("{\"text")) {
e = JSON.parse(err.substr(PREFIX.length)).text
output.appendLine(e.replace(ansiRegex(),''));
output.appendLine(e.replace([
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
].join('|'),''));
errors = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function makeTerminal() {
if(tc) {
term.dispose();
}
tc = term
tc = term;
}
}
if(!tc) {
Expand Down
6 changes: 3 additions & 3 deletions src/one-click/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ export async function paths(globalPath: string, system: string, context : vscode
// (path.join(globalPath, "install", `pros-cli-${system}`));
// Check if user has CLI installed through one-click or other means.
let [version, oneClicked] = await getCurrentVersion(path.join(globalPath, "install", `pros-cli-${system}`, "pros"));
PATH_SEP = system==="windows" ? ";" : ":";
PATH_SEP = (system==="windows" ? ";" : ":");
process.env["VSCODE FLAGS"] = (version>=324?"--no-sentry --no-analytics":"");
console.log("paths")
console.log(version);
if (!oneClicked) {
// Use system defaults if user does not have one-click CLI
CLI_EXEC_PATH = "";
Expand All @@ -179,7 +179,7 @@ export async function paths(globalPath: string, system: string, context : vscode
// Prepend CLI to path
process.env['PATH'] = CLI_EXEC_PATH+PATH_SEP+process.env['PATH'];
// Having `PROS_TOOLCHAIN` set to TOOLCHAIN breaks everything, so idk. Empty string works don't question it
process.env['PROS_TOOLCHAIN'] = TOOLCHAIN
process.env['PROS_TOOLCHAIN'] = TOOLCHAIN;
process.env.LC_ALL = "en_US.utf-8";
// Remake terminal with updated environment variables
makeTerminal();
Expand Down
7 changes: 4 additions & 3 deletions src/one-click/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export async function getCliVersion(url: string) {
}

export async function getCurrentVersion(oneClickPath: string) {
console.log("getCurrentVersion");
var oc = false;
var versionint = -1;
try {
Expand All @@ -30,9 +29,11 @@ export async function getCurrentVersion(oneClickPath: string) {
`pros --version`
);
versionint = +(stdout.replace("pros, version ","").replace(/\./gi,""));
} catch{}
} catch(err) {
console.log(err);
}
}
return [versionint, oc]
return [versionint, oc];
}

export async function getInstallPromptTitle(oneClickPath: string) {
Expand Down

0 comments on commit d002ca6

Please sign in to comment.