jaime-olivares / vscode-yuml

yUML extension for Visual Studio Code
MIT License
116 stars 26 forks source link

Active editor doesn't show a yUML document #46

Closed rylphs closed 5 years ago

rylphs commented 6 years ago

Trying to preview the yUML diagram of any yuml file gives me the foloing error:

Active editor doesn't show a yUML document

My vscode installation info:

Version: 1.26.1
Commit: 493869ee8e8a846b0855873886fc79d480d342de
Date: 2018-08-16T18:34:20.517Z
Electron: 2.0.5
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

Here is a sample diagram that I tried (got it from the repository):

// Activity diagram for the main process of the yUML extension for VSCode
// {type:activity}
// {generate:true} 
// {direction:leftToRight}  
(start)->(Parse .YUML\rfile)->(Create .DOT\rdocument)
(Create .DOT\rdocument)->(Generate SVG)
(Generate SVG)->(Output to\rPreviewer)
(Output to\rPreviewer)->|e|
(Generate SVG)-><g>[generate: false]->|e|
<g>[generate: true]->(Output to\rFile) 
(Output to\rFile)->|e|->(end)
rylphs commented 6 years ago

Another thing I've noticed is that when you try to preview the diagram it splits the window and shows in the right window the error message above as I said. But if you, in the right window, open the source yuml file and call the preview command again a error is shown in a popup window:

Unable to open '/vscode-yuml': Cannot read property 'document' of undefined.

and a SVG file with the diagram is generated.

In the first scenario (try to call the command in the left window) this message is not showed and no SVG is generated.

jaime-olivares commented 6 years ago

Does this error persist? I don't have any other report from thousand of users.

bparlan commented 6 years ago

But if you, in the right window, open the source yuml file and call the preview command again a error is shown in a popup window:

I experience this with quite different version. My yuml file was on right windows while everything else was on left. So when I run "View yUML Diagram", it gave me only the popup error with no diagram or new window:

Unable to open '/vscode-yuml': Cannot read property 'document' of undefined.

When I merge right and left windows and run "View yUML Diagram" on single window screen, it creates new window to right, draws diagram, but still i recieve same popup error.

Angusoft-India commented 5 years ago

Iam getting the same error Active editor doesn't show a yUML document

AlessioMorale commented 5 years ago

I had the same issue. After the removal of // {generate:true} the diagram is shown again. Once it is shown again you can put back the macro inside the yuml file.

colin-young commented 5 years ago

Here's what I've noticed (Visual Studio Code 1.30.2 on Windows 10):

Removing // {generate:true} didn't have any effect for me.

My guess is that something in VS Code changed that is now more aggressively notifying the preview window of what document is current. Would it be possible to make the preview track the document it was opened from instead of trying to preview whatever currently has focus? The markdown preview window appears to work that way and has no trouble if I change the current editor to a non-markdown document (i.e. it continues to display whichever document I was previewing).

jaime-olivares commented 5 years ago

Possibly fixed in 3.2 (please confirm)