From a99b8efa0e0f9c49c280fe92d0d01adc69493165 Mon Sep 17 00:00:00 2001 From: tintinweb Date: Fri, 8 May 2020 11:16:33 +0200 Subject: [PATCH] address breaking change with graphviz-interactive-preview --- src/features/commands.js | 50 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/src/features/commands.js b/src/features/commands.js index 8a2b034..e2f1043 100644 --- a/src/features/commands.js +++ b/src/features/commands.js @@ -179,18 +179,21 @@ class Commands{ vscode.workspace.openTextDocument({content: ret, language: "dot"}) .then(doc => { if(settings.extensionConfig().preview.dot){ - vscode.commands.executeCommand("interactive-graphviz.preview.beside", {document: doc, content:ret, callback:null}) + vscode.commands.executeCommand("graphviz-interactive-preview.preview.beside", {document: doc, content:ret, callback:null}) .catch(error =>{ - vscode.commands.executeCommand("graphviz.previewToSide", doc.uri) - .catch(error => { - //command not available. fallback open as text and try graphviz.showPreview - vscode.window.showTextDocument(doc, vscode.ViewColumn.Beside) - .then(editor => { - vscode.commands.executeCommand("graphviz.showPreview", editor) // creates new pane - .catch(error => { - //command not available - do nothing - }); - }); + vscode.commands.executeCommand("interactive-graphviz.preview.beside", {document: doc, content:ret, callback:null}) //TODO: remove this in future version. only for transition to new command + .catch(error =>{ + vscode.commands.executeCommand("graphviz.previewToSide", doc.uri) + .catch(error => { + //command not available. fallback open as text and try graphviz.showPreview + vscode.window.showTextDocument(doc, vscode.ViewColumn.Beside) + .then(editor => { + vscode.commands.executeCommand("graphviz.showPreview", editor) // creates new pane + .catch(error => { + //command not available - do nothing + }); + }); + }); }); }); } else { @@ -208,18 +211,21 @@ class Commands{ vscode.workspace.openTextDocument({content: ret, language: "dot"}) .then(doc => { if(settings.extensionConfig().preview.dot){ - vscode.commands.executeCommand("interactive-graphviz.preview.beside", {document: doc, content:ret, callback:null}) + vscode.commands.executeCommand("graphviz-interactive-preview.preview.beside", {document: doc, content:ret, callback:null}) .catch(error =>{ - vscode.commands.executeCommand("graphviz.previewToSide", doc.uri) - .catch(error => { - //command not available. fallback open as text and try graphviz.showPreview - vscode.window.showTextDocument(doc, vscode.ViewColumn.Beside) - .then(editor => { - vscode.commands.executeCommand("graphviz.showPreview", editor) // creates new pane - .catch(error => { - //command not available - do nothing - }); - }); + vscode.commands.executeCommand("interactive-graphviz.preview.beside", {document: doc, content:ret, callback:null}) //TODO: remove this in future version. only for transition to new command + .catch(error =>{ + vscode.commands.executeCommand("graphviz.previewToSide", doc.uri) + .catch(error => { + //command not available. fallback open as text and try graphviz.showPreview + vscode.window.showTextDocument(doc, vscode.ViewColumn.Beside) + .then(editor => { + vscode.commands.executeCommand("graphviz.showPreview", editor) // creates new pane + .catch(error => { + //command not available - do nothing + }); + }); + }); }); }); } else {