madskristensen / JavaScriptPrettier

A Visual Studio extension
Other
158 stars 30 forks source link

Feature Request: Execute on save #6

Closed scottadamsmith closed 6 years ago

scottadamsmith commented 7 years ago

Description

In some other editors (i.e. VS Code), Prettier can be configured to format on save. It would be great to have this functionality in Visual Studio as well.

I am not sure how feasible this is as it is likely largely dependent on the capabilities of a VS extensions. Can anyone provide any insight into the level of difficulty for something like this? I am happy to look into it myself and potentially in attempt a contribution for it if the effort is realistic.

Thanks!

SwannLV commented 6 years ago

This would be the perfection.

jesperbjensen commented 6 years ago

Iā€™m all for it. If someone wants to help out with this feature it would be awesome. (You need to be able to turn it on and off)

tommck commented 6 years ago

I'm working on this right now, but it's proving difficult. The IVsRunningDocTableEvents3 is all Sync methods when all the current NodeProcess stuff is async.

I may have to make a sync version of the methods in there unless @madskristensen or @jesperbjensen have any better ideas.

Also need to figure out how to make it load at startup/opening of a solution

tommck commented 6 years ago

I figured out a hacked way. PR incoming

jesperbjensen commented 6 years ago

So this feature should be available in the CI build: http://vsixgallery.com/extension/J1da7ad9e-85b3-4a0c-8e45-b2ae59a575a7/

Thanks to @tommck for implementing the feature. šŸ‘šŸŽ‰

tommck commented 6 years ago

Do we have plans for a release any time soon? Just curious

madskristensen commented 6 years ago

@tommck, I can publish any time. Did you test the CI build @jesperbjensen linked to?

tommck commented 6 years ago

uhh.. .lemme try that now :)

tommck commented 6 years ago

Yep, it's working fine. You were OK with the hacked up way I did that, @madskristensen ?

madskristensen commented 6 years ago

Yes I am

tommck commented 6 years ago

Wait, don't publish this if you haven't already

UPDATE: Never mind.. local change issue :)

UPDATE 2: NOT a local change issue. Don't publish this. The extension crashes every time you save on a non-supported file type. I will fix that