Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/flowr/diagrams/diagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ class DiagramUpdateCoordinator {
const options = optionsFromDiagramType(type);
const mermaid = await definition.retrieve(options as never, editor);

// Don't show a panel if generation failed
if(mermaid === '') {
return;
}

const panel = createDiagramWebview({
mermaid: mermaid,
options: options,
Expand Down
22 changes: 20 additions & 2 deletions src/flowr/internal-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,29 @@ export class FlowrInternalSession implements FlowrSession {
}

private async startWorkWithProgressBar<T = void>(document: vscode.TextDocument, actionFn: (analyzer: FlowrAnalyzer) => Promise<T>, action: WorkActions, showErrorMessage: boolean, defaultOnErr = {} as T): Promise<T> {
this.setWorking(true);

// Wait for the flowr session
if(!this.parser) {
return defaultOnErr;
const times = [3000, 2000, 1000];
while(times.length != 0) {
const timeout = times.pop();
this.outputChannel.appendLine(`FlowR Session not available - retrying in ${timeout}ms`);
await new Promise(res => setTimeout(res, timeout));

if(this.parser) {
break;
}
}

if(!this.parser) {
this.setWorking(false);
await vscode.window.showErrorMessage('Failed to generate diagram - FlowR Analyzer Session is not ready!');
return defaultOnErr;
}
}

this.setWorking(true);

const analyzer = await analyzerFromDocument(document, this.parser);

// update the vscode ui
Expand Down
Loading