Skip to content

Commit

Permalink
Show model/spec name in VSCode status bar.
Browse files Browse the repository at this point in the history
Implements Github issue #285
#285

[Feature]
  • Loading branch information
lemmy committed Apr 25, 2023
1 parent 6eebff8 commit c43a1ae
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/commands/checkModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export async function doCheckModel(
try {
lastCheckFiles = specFiles;
vscode.commands.executeCommand('setContext', CTX_TLC_CAN_RUN_AGAIN, true);
updateStatusBarItem(true);
updateStatusBarItem(true, specFiles);
const procInfo = await runTlc(
specFiles.tlaFilePath, path.basename(specFiles.cfgFilePath), showOptionsPrompt, extraOpts);
if (procInfo === undefined) {
Expand All @@ -185,7 +185,7 @@ export async function doCheckModel(
checkProcess = procInfo.process;
checkProcess.on('close', () => {
checkProcess = undefined;
updateStatusBarItem(false);
updateStatusBarItem(false, lastCheckFiles);
});
if (showCheckResultView) {
attachFileSaver(specFiles.tlaFilePath, checkProcess);
Expand Down Expand Up @@ -292,9 +292,13 @@ async function checkModelExists(cfgPath: string, warn = true): Promise<boolean>
return cfgExists;
}

function updateStatusBarItem(active: boolean) {
statusBarItem.text = 'TLC' + (active ? ' $(gear~spin)' : '');
statusBarItem.tooltip = 'TLA+ model checking' + (active ? ' is running' : ' result');
function updateStatusBarItem(active: boolean, specFiles: SpecFiles | undefined) {
statusBarItem.text = 'TLC' + (active ?
(specFiles === undefined ? '' : ' (' + specFiles.tlaFileName + '/' + specFiles.cfgFileName + ')')
+ ' $(gear~spin)' : '');
statusBarItem.tooltip = 'TLA+ model checking' + (active ?
(specFiles === undefined ? '' : ' of ' + specFiles.tlaFileName + '/' + specFiles.cfgFileName)
+ ' is running' : ' result');
statusBarItem.command = CMD_CHECK_MODEL_DISPLAY;
statusBarItem.show();
vscode.commands.executeCommand('setContext', CTX_TLC_RUNNING, active);
Expand Down

0 comments on commit c43a1ae

Please sign in to comment.