vscode-svgviewer icon indicating copy to clipboard operation
vscode-svgviewer copied to clipboard

SVG preview doesn't work

Open yantakus opened this issue 7 years ago • 12 comments

When I press Alt+S O or choose SVG Viewer: View SVG from the command palette nothing happens.

The filetype is XML. Extension version: 1.3.0. VS Code version: 1.8.1.

yantakus avatar Jan 17 '17 07:01 yantakus

@yantakus

nothing happens.

Have you not received an error message ? (developper tool or vscode standard message) Don't open a preview window?

cssho avatar Feb 02 '17 16:02 cssho

Mine also doesn't work no errors when I use the command. I did see an error later saying no svg inactive workspace. Super delayed.

curioussavage avatar Apr 11 '17 23:04 curioussavage

On Ubuntu I get the message: "Active editor doesn't show a SVG document - no properties to preview." I am testing with an SVG file that I found in this repository:

<?xml version="1.0"?>
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
 <!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
 <g>
  <title>Layer 1</title>
  <circle stroke="#333333" fill-opacity="0" id="svg_4" r="48.000004" cy="59.500001" cx="105" stroke-width="20" fill="#000000"/>
  <rect cy="60" transform="rotate(45 37.99999999999999,125.5) " id="svg_7" height="85" width="20" y="83" x="28" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="10" fill="#333333" stroke-opacity="0" stroke="#000000"/>
  <path stroke="#000000" stroke-opacity="0" id="svg_2" d="m124.592659,149.699597c7.254473,0 14.508951,0 21.763424,0c0,5.010636 0,10.021277 0,15.031913c-7.254473,0 -14.508951,0 -21.763424,0c0,-5.010636 0,-10.021277 0,-15.031913zm-31.436068,0c8.060478,0 16.121112,0 24.181595,0c0,5.010636 0,10.021277 0,15.031913c-8.060478,0 -16.121112,0 -24.181595,0c0,-5.010636 0,-10.021277 0,-15.031913zm-29.017903,0c8.060478,0 16.121106,0 24.181584,0c0,5.010636 0,10.021277 0,15.031913c-8.060478,0 -16.121112,0 -24.181584,0c0,-5.010636 0,-10.021277 0,-15.031913zm-29.017903,0c8.060478,0 16.121106,0 24.181589,0c0,5.010636 0,10.021277 0,15.031913c-8.060483,0 -16.121106,0 -24.181589,0c0,-5.010636 0,-10.021277 0,-15.031913zm89.471874,30.998507c7.657545,-0.339387 15.314956,0.239793 22.972507,-0.099594c0.491331,-5.289003 0.263753,-10.578018 0.755084,-15.867022c7.166219,0 15.051349,0 22.217417,0c0,-5.010636 0,-10.02128 0,-15.031913c-7.254473,0 -14.508951,0 -21.763424,0c0,-5.567385 0,-11.134756 0,-16.702127c-8.060478,0 -16.121106,0 -24.181584,0c0,-5.010636 0,-10.021277 0,-15.031913c8.060478,0 16.121106,0 24.181584,0c0,5.010636 0,10.021277 0,15.031913c7.166074,0 15.051203,-0.248272 22.217417,-0.248272c0.491331,5.288989 0.263758,10.826287 0.755095,16.11529c7.65754,0.339376 15.422955,-0.028791 23.080511,0.310584c0,4.949635 -0.108009,10.606794 -0.108009,15.556437c-8.060478,0 -16.121106,0 -24.181584,0c0,5.567382 0,11.134745 0,16.702127c-7.254473,0 -14.508951,0 -21.763424,0c0,5.010636 0,10.021277 0,15.031913c-8.060478,0 -16.121106,0 -24.181584,0c0,-4.949635 0,-10.817796 0,-15.767435l-0.000005,0.000011z" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="15" fill="#333333"/>
 </g>
</svg>

abudaan avatar Apr 14 '17 11:04 abudaan

@abudaan The condition in which the message is displayed is when languageId is not xml or the end of the file does not end with "</ svg>". Has that file been saved already?

cssho avatar Apr 22 '17 18:04 cssho

Thanks for your reply; meanwhile I did a clean install of Xubuntu 17.04, vscode and your plugin and it works like a charm now! I guess my old installation was corrupted.

abudaan avatar May 01 '17 17:05 abudaan

Does not work for me either. there is no option in the context menu the keyboard method does not work and when I use the command line to open the preview the image I see is not my SVG but something resembling a miniature postage stamp. There are no error messages at all.

deevincentday avatar May 15 '18 08:05 deevincentday

Did not work for me either. But it does work after installing XML Tools.

AlexanderLieret avatar Mar 11 '19 12:03 AlexanderLieret

Did not work for me either. But it does work after installing XML Tools.

just my 5c: this hint did not help me 😞

ZuBB avatar Mar 29 '19 12:03 ZuBB

For me the trick was to not split my opening SVG tag's attributes onto multiple lines

dkniffin avatar Jul 05 '19 18:07 dkniffin

For me the trick was to not split my opening SVG tag's attributes onto multiple lines

This worked for me, thanks!

spacepluk avatar Aug 10 '19 19:08 spacepluk

For me the trick was to not split my opening SVG tag's attributes onto multiple lines

Same thing here. There's probably a bad parser being used by this extension.

Eitz avatar Sep 03 '19 08:09 Eitz

I also got the message:

Active editor doesn't show a SVG document - no properties to preview.

I fixed it by installing the XML Tools extension and then apply Format Document from View>Command Palette....

gilles6 avatar Oct 16 '19 06:10 gilles6