Skip to content

Commit

Permalink
address breaking change with graphviz-interactive-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
tintinweb committed May 8, 2020
1 parent 919207c commit a99b8ef
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions src/features/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit a99b8ef

Please sign in to comment.