我已经为 Visual Studio 2015 工具安装了 TypeScript,编译速度非常快(与我的旧 Gulp 进程相比)。我在 tsconfig 文件中保存设置时进行编译,一切正常!
但是,如果我撤消源代码管理中的更改,它似乎不会像 Ctrl+S 那样触发编译。有什么方法可以让 VS 在源代码管理更改的文件上启动文件保存?
最佳答案
请注意,在源代码管理中有 3 种不同的方式来“撤消更改”:参见“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.
有no git hook for post-reset action .
(尽管Visual Studio 2017 did introduce client-side Git hook support)
这给你留下了某种 service hook ,但它们在服务器端(对于上游 Visual Studio Online 项目)
如果您的重置/撤消操作影响事件文档,可能会起作用。
在这种情况下,您可以使用 DocumentEvents
来触发 typescript 编译。
这不是一个完整的解决方案,而是一个起点。
关于git - 在源代码管理文件更改后运行 TypeScript 编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42681897/