madskristensen / VuePack2017

A Visual Studio extension
Other
37 stars 14 forks source link

Any plans to support Ctrl-K-D formatting of javascript? #2

Closed 9swampy closed 7 years ago

9swampy commented 7 years ago

First of all, good work: appreciated. However HTML gets formatted fine but the Javascript doesn't. Any plans?

madskristensen commented 7 years ago

That is a bug for the JavaScript team to fix in VS. @billti is this a known issue that Format Document doesn't work in <script> blocks in a .vue file? This extension maps .vue files to the HTML editor

billti commented 7 years ago

@jramsay would be the most knowledgeable here. Jason, any idea?

jramsay commented 7 years ago

@madskristensen (cc @billti): tested it out and it looks like it is more than just formatting that isn't working in .vue files. None of the JS language service features are working except classification as this uses textmate. This is due to an InvalidOperationException when we attempt to add the document in Roslyn. This occurs because Roslyn is unable to determine the host type for the document. For other HTML editor files (.html, .ascx, .aspx) the ContentType is HTML:

example: ASPX aspx

For the .vue file however the ContentType is Vue vue

Not sure where you set this but if you can make it match the other HTML editor content types it should work.

Alternatively, Steve Dower has this PR out on the Roslyn side that might fix the issue here as well. Not sure when this fix is targeted for though: https://github.com/dotnet/roslyn/pull/17221

madskristensen commented 7 years ago

Fixed

9swampy commented 7 years ago

Works for me, great stuff. Thanks for listening :)