vscode-svgviewer
vscode-svgviewer copied to clipboard
SVG preview doesn't work
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
nothing happens.
Have you not received an error message ? (developper tool or vscode standard message) Don't open a preview window?
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.
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 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?
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.
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.
Did not work for me either. But it does work after installing XML Tools.
Did not work for me either. But it does work after installing XML Tools.
just my 5c: this hint did not help me 😞
For me the trick was to not split my opening SVG tag's attributes onto multiple lines
For me the trick was to not split my opening SVG tag's attributes onto multiple lines
This worked for me, thanks!
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.
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...
.