Skip to content

Commit

Permalink
add some more logging to the extension startup
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Apr 26, 2024
1 parent 126a00d commit c0b55ad
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/turbo-vsc/src/extension.ts
Expand Up @@ -42,6 +42,8 @@ const decoration = window.createTextEditorDecorationType({
color: "#04f1f9", // something like cyan
});

const logs = window.createOutputChannel("Turbo");

function rainbowRgb(i: number) {
const f = 0.5;
const r = Math.sin(f * i + (4.0 * Math.PI) / 3.0) * 127.0 + 128.0;
Expand Down Expand Up @@ -72,8 +74,8 @@ export function activate(context: ExtensionContext) {
const useLocalTurbo: boolean = turboSettings.get("useLocalTurbo") ?? false;

if (turboPath && !fs.existsSync(turboPath)) {
window.showErrorMessage(
`turbo does not exist at path \`${turboPath}\`, attempting to locate it`
logs.appendLine(
`manually specified turbo does not exist at path \`${turboPath}\`, attempting to locate it`
);
turboPath = undefined;
}
Expand All @@ -97,18 +99,22 @@ export function activate(context: ExtensionContext) {
promptGlobalTurbo(useLocalTurbo);
turboPath = findLocalTurbo();
} else {
window.showErrorMessage(e.message);
logs.appendLine(`unable to find turbo: ${e.message}`);
}
}

if (turboPath) {
logs.appendLine(`using turbo at path: ${turboPath}`);
}

context.subscriptions.push(
commands.registerCommand("turbo.daemon.start", () => {
cp.exec(`${turboPath} daemon start`, options, (err) => {
if (err) {
if (err.message.includes("command not found")) {
promptGlobalTurbo(useLocalTurbo);
} else {
window.showErrorMessage(JSON.stringify(err));
logs.appendLine(`unable to start turbo: ${err.message}`);
}
} else {
updateStatusBarItem(true);
Expand All @@ -125,7 +131,7 @@ export function activate(context: ExtensionContext) {
if (err.message.includes("command not found")) {
promptGlobalTurbo(useLocalTurbo);
} else {
window.showErrorMessage(err.message);
logs.appendLine(`unable to stop turbo: ${err.message}`);
}
} else {
updateStatusBarItem(false);
Expand All @@ -142,7 +148,7 @@ export function activate(context: ExtensionContext) {
if (err.message.includes("command not found")) {
promptGlobalTurbo(useLocalTurbo);
} else {
window.showErrorMessage(err.message);
logs.appendLine(`unable to get turbo status: ${err.message}`);
updateStatusBarItem(false);
}
} else {
Expand Down

0 comments on commit c0b55ad

Please sign in to comment.