6

I've installed the TypeScript for Visual Studio 2015 tools and the compile is wicked fast (compared to my old Gulp process). I have compile on save setup in the tsconfig file and that all works great!

However, if I undo a change from source control, it doesn't seem to trigger the compile the way Ctrl+S does. Is there any ways to make VS kick off a file save on a file that was changed by source control?

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Jim Brown
  • 498
  • 1
  • 6
  • 20

1 Answers1

0

Note that there are 3 different way to "undo a change" in source control: See "Undo changes"

  • Discard uncommitted changes to a file, bringing the file back to the version in the last commit.
  • Reset your local branch to a previous commit.
  • Revert changes pushed to a remote branch and shared with others.

There is no git hook for post-reset action.
(Even though Visual Studio 2017 did introduce client-side Git hook support)

That leaves you with some kind of service hook, but they are on the server side (for an upstream Visual Studio Online project)

What might work if is your reset/undo affect the active document.
In that case, you can use the DocumentEvents to trigger a typescript compilation.
It is not a complete solution, but a starting point.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • As stated in my question, I'm using Visual Studio 2015. I am selecting the file in the Changes window and hitting Undo. I have no idea what VS 2015 does under the covers to accomplish that. – Jim Brown Jul 05 '17 at 20:50
  • Having the document open and active during the Undo doesn't make any difference, so that won't work unfortunately. – Jim Brown Jul 05 '17 at 20:51
  • @JimBrown I understand. I tried to outline the different options, but I didn't find a clear way to do what you are after, which is what my answer points out. – VonC Jul 05 '17 at 21:09
  • So there is no way to do it. Gotta love VS TypeScript compiler. What trash. – Jim Brown Jul 06 '17 at 20:44