Add failure loop to installation selection
[?]
Dec 22, 2020, 10:29 PM
TKKT6D4C75R7WSRJY5IWX7OJR5M6B5IWYEN5BKMVFQZTECYGWVJQCDependencies
- [2]
WHFIIX4YImprove documentation and add Pijul installation configuration - [3]
3N3RS66TCreate pijul output channel and configure activation events - [4]
NCBEWRYEInitialize Repository - [5]
WW67NYZVConfigure eslint for JS standard formatting
Change contents
- replacement in src/extension.ts at line 5
async function checkPijulInstallation (config: vscode.WorkspaceConfiguration, outputChannel: vscode.OutputChannel) {let path = config.get<string>("installationPath");export interface IPijul {path: string;version: string;} - edit in src/extension.ts at line 10
async function checkPijulInstallation (path: string | undefined, config: vscode.WorkspaceConfiguration, outputChannel: vscode.OutputChannel): Promise<IPijul> { - replacement in src/extension.ts at line 46
return;return Promise.reject(new Error("No executable selected in file dialogue")); - replacement in src/extension.ts at line 49
config.update("ignoreMissingInstallation", true);return;await config.update("ignoreMissingInstallation", true);return Promise.reject(new Error("Ignore")); - replacement in src/extension.ts at line 54
return;return Promise.reject(new Error("Ignore")); - replacement in src/extension.ts at line 58
const child = cp.spawn(path, ["--version"]);child.stdout.on("data", (b: Buffer) => outputChannel.append(b.toString()));return new Promise<IPijul>((resolve, reject) => {const pathDefined = path || "pijul";const child = cp.spawn(pathDefined || "pijul", ["--version"]);const buffers: Buffer[] = [];child.stdout.on("data", (b: Buffer) => buffers.push(b));child.on("error", () => reject(new Error("Error checking version at " + path)));child.on("close", code => {if (code) {reject(new Error("Error checking version at " + path));} else {resolve({ path: pathDefined, version: Buffer.concat(buffers).toString("utf8").trim().split(" ")[1] });}});}); - replacement in src/extension.ts at line 89
await checkPijulInstallation(config, outputChannel);const installationPath = config.get<string>("installationPath");// Make sure that the Pijul installation is validlet identifiedInstallation = false;let pijul;while (!identifiedInstallation) {try {pijul = await checkPijulInstallation(installationPath, config, outputChannel);outputChannel.appendLine(`Using Pijul ${pijul.version} located at ${pijul.path}`);identifiedInstallation = true;} catch (err) {if (err.message === "Ignore") {// Complete activation without finding the installationidentifiedInstallation = true;return;} else {// Reset the configuration and try againvscode.window.showErrorMessage(`Failed to find pijul installation at ${err.message.split(" ").pop()}, resetting...`);}}}