Skip to content

Commit

Permalink
Hide on error
Browse files Browse the repository at this point in the history
  • Loading branch information
toku-sa-n committed Feb 13, 2024
1 parent ce546ba commit a6acbbe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ export async function activateStatusBar({
}

async function updateStsatusBarmItem(): Promise<void> {
statusBarItem.text = await runMsgfmtStatistics();
const output = await runMsgfmtStatistics();

if (output) {
statusBarItem.text = output;
statusBarItem.show();
} else {
statusBarItem.hide();
}
}

async function runMsgfmtStatistics(): Promise<string> {
async function runMsgfmtStatistics(): Promise<string | null> {
const path = vscode.window.activeTextEditor?.document.uri.fsPath;

if (!path) {
return null;
}

const command = `msgfmt --statistics -o /dev/null ${path}`;

return new Promise((resolve, reject) => {
Expand Down

0 comments on commit a6acbbe

Please sign in to comment.