You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make "compileOnSave" option of tsconfig.json recognized by vscode #7015
There is no a workaround to this problem. Please consider doing something about bringing it to life.
Reacted by Morten Christensen, Julien Chaumond, Steven, mrcrowl, Max Desiatov, Shahar Hadas, Piotr Mionskowski, Sergey Morenko, Eduard Urbach, Robert Sauer and 4 more
Added a comment to stackoverflow. This is supported right now via a watch task. But I agree that the tsconfig.json option should be supported as well, which has to come from the TS team though.
the problem with "watch" is that vscode doesn't allow to run the test command while watching typescript, saying there is another command running, so at least with having to run the tests from under vscode "watch" isn't an option
Steven (@styfle) it should work with VS Code without additional integration effort. But please note that VS Code still ships with 1.8.10 and I think the feature will not make it out of the box into 2.0 either.
mrcrowl you are correct that the current implementation in the tsserver does require quite some work in the extensions. I started a discussion with the TS team about this here: microsoft/TypeScript#11526
The bottom line is that this doesn't belong into the extension since the extension can never implement this in a efficient way (and the TS team agrees on this). Especially since compileOnSave must also do problem checking. Doesn't make to much sense to write a new JS file without telling the user that you now have compile errors in dependent files.
Shouldn't this be re-opened if there is more work to be done in VSCode code base? I'm running 2.2.0-dev in stable VSCode, the compile on save does not work with it.
Edit: Reason this bug would be nice to be open, so one could track when it becomes feasible to use.
mrcrowlDirk Bäumer (@dbaeumer) Installing that would be a hack around right? When is it officially landing in vscode? I'm running on the latest typescript afaik.
dbaumer, your comment from May 18 refers to a preview feature in vscode 13.x that simplifies build tasks for TypeScript (see release notes), which is great... but this feature hasn't yet addressed "compileOnSave", right?
As I see it, there are two groups of people wanting "compileOnSave":
Group 1 just want TypeScript compilation with minimal configuration, for small-to-medium sized projects.
Group 2 want performant TypeScript compilation for larger projects (this is the promise of TypeScript, right? "JavaScript that scales")
Group 1 are well-covered by a combination of tsconfig.json + watch + tasks.json, i.e. file-system watcher that incrementally builds when a file change is detected.
I'm concerned with Group 2, who are working on larger projects where even the incremental build takes too long to run. Based on Dirk Bäumer (@dbaeumer)'s May 5 comment there is an awareness of this within the TypeScript and vscode teams (...is there an issue for this?)
In the meantime, my team needed a way to continue fast TypeScript compiles, often for individual files within the context of a large project. Hence, the provided extension which uses existing tsserver apis to achieve a pragmatic compile-on-save behaviour, while we wait for an official solution to materialize.
The built-in TypeScript extension runs a tsserver instance in the background, which is synchronised with editor changes. In order to take advantage of that same tsserver instance my version of the extension has to replace the built-in TypeScript extension. It's possible a similar result could now be achieved as a typescript server plugin, although I haven't investigated that route yet.
Building a performant incremental builder for large projects is not trivial (as you might have noticed as well). The TS team is still on this but it might be helpful if you start to vote on microsoft/TypeScript#11229
Right now TypeScript 2.4 is landed, but i think there is no news about compileOnSave fix on TS Server or language service. Do we have to wait also VSCode new version to have a productive environment? Vsix from mrcrowl is really a good start (thanks again) but i think that we have to expect an official solution. am i wrong?
Reacted by Riccardo Pancotti, Frank Felix Debatin, Joshua Sachs and Yin Zhong
The script will pick up the tsconfig.json compilerOptions. Only downside is that it will not output any errors whatsoever since the process is detached to allow for parallel executions of the task in case multiple files are saved.
It sucks that this issue has been closed, as it doesn't appear any official support addressing this has been provided. Visual Studio seems to do this out of the box, without the need to run a battery draining background process during development.
Reacted by Diego Bonura, Shahar Hadas and Frank Felix Debatin
Activity
dbaeumer commentedon May 30, 2016
Added a comment to stackoverflow. This is supported right now via a watch task. But I agree that the tsconfig.json option should be supported as well, which has to come from the TS team though.
dbaeumer commentedon May 30, 2016
I opened microsoft/TypeScript#8884 since the support has to go there. I will close this issue as upstream.
zpdDG4gta8XKpMCd commentedon May 30, 2016
the problem with "watch" is that vscode doesn't allow to run the test command while watching typescript, saying there is another command running, so at least with having to run the tests from under vscode "watch" isn't an option
dbaeumer commentedon May 30, 2016
We have feature request to allow more than one command.
dbaeumer commentedon May 30, 2016
As said I close this one since it will be addressed in tsserver.
zpdDG4gta8XKpMCd commentedon Aug 25, 2016
Merged microsoft/TypeScript#9837
styfle commentedon Aug 25, 2016
Dirk Bäumer (@dbaeumer) Now that it is merged in tsserver will it simply work with vscode or will there need to be more work to integrate it?
dbaeumer commentedon Aug 26, 2016
Steven (@styfle) it should work with VS Code without additional integration effort. But please note that VS Code still ships with 1.8.10 and I think the feature will not make it out of the box into 2.0 either.
mrcrowl commentedon Nov 5, 2016
Dirk Bäumer (@dbaeumer) From what I can see, there is additional integration effort needed to enable compile on save in VSCode for TypeScript. Since v2.0.5, tsserver has supported the new API methods
compileOnSaveAffectedFileListandcompileOnSaveEmitFile, but they need to be called from the typescript extension. I've done some prelim work on getting this going for myself and would be happy to make a pull request if there was support? (WIP here if you want to have a look: https://github.com/mrcrowl/vscode/tree/master/extensions/typescript)dbaeumer commentedon Nov 7, 2016
mrcrowl you are correct that the current implementation in the tsserver does require quite some work in the extensions. I started a discussion with the TS team about this here: microsoft/TypeScript#11526
The bottom line is that this doesn't belong into the extension since the extension can never implement this in a efficient way (and the TS team agrees on this). Especially since compileOnSave must also do problem checking. Doesn't make to much sense to write a new JS file without telling the user that you now have compile errors in dependent files.
So I would opt that instead of adding this to the extension your effort is better put into the tsserver to make this work. I started this along time ago here: https://github.com/Microsoft/TypeScript/blob/dbaeumer/9125/src/server/builder.ts and parts of the work made it into 2.0.6. But still no full builder. Their current builder only manages dependencies: https://github.com/Microsoft/TypeScript/blob/master/src/server/builder.ts
Ciantic commentedon Dec 6, 2016
Shouldn't this be re-opened if there is more work to be done in VSCode code base? I'm running 2.2.0-dev in stable VSCode, the compile on save does not work with it.
Edit: Reason this bug would be nice to be open, so one could track when it becomes feasible to use.
Edit2: Or is this the main bug microsoft/TypeScript#11526 one could track for this feature?
23 remaining items
mrcrowl commentedon Jun 14, 2017
For anyone still interested in compile-on-save, here's an unofficial .vsix you can manually install in vs code 13.x that replaces the built-in typescript extension, with one that supports the compileOnSave setting in tsconfig.json:
https://github.com/mrcrowl/vscode/releases/tag/13.10.8
edit: added "unofficial"
Dashue commentedon Jun 15, 2017
mrcrowl Dirk Bäumer (@dbaeumer) Installing that would be a hack around right? When is it officially landing in vscode? I'm running on the latest typescript afaik.
mrcrowl commentedon Jun 15, 2017
dbaumer, your comment from May 18 refers to a preview feature in vscode 13.x that simplifies build tasks for TypeScript (see release notes), which is great... but this feature hasn't yet addressed "compileOnSave", right?
Johan Nilsson (@Dashue), yes, installing this extension is a hack that is not officially supported. Here's a bit of background:
As I see it, there are two groups of people wanting "compileOnSave":
Group 1 just want TypeScript compilation with minimal configuration, for small-to-medium sized projects.
Group 2 want performant TypeScript compilation for larger projects (this is the promise of TypeScript, right? "JavaScript that scales")
Group 1 are well-covered by a combination of tsconfig.json + watch + tasks.json, i.e. file-system watcher that incrementally builds when a file change is detected.
I'm concerned with Group 2, who are working on larger projects where even the incremental build takes too long to run. Based on Dirk Bäumer (@dbaeumer)'s May 5 comment there is an awareness of this within the TypeScript and vscode teams (...is there an issue for this?)
In the meantime, my team needed a way to continue fast TypeScript compiles, often for individual files within the context of a large project. Hence, the provided extension which uses existing tsserver apis to achieve a pragmatic compile-on-save behaviour, while we wait for an official solution to materialize.
The built-in TypeScript extension runs a tsserver instance in the background, which is synchronised with editor changes. In order to take advantage of that same tsserver instance my version of the extension has to replace the built-in TypeScript extension. It's possible a similar result could now be achieved as a typescript server plugin, although I haven't investigated that route yet.
dbaeumer commentedon Jun 16, 2017
mrcrowl here some issues in the TS land about compile on save and a full builder in the TS server:
microsoft/TypeScript#9125
microsoft/TypeScript#11229
Building a performant incremental builder for large projects is not trivial (as you might have noticed as well). The TS team is still on this but it might be helpful if you start to vote on microsoft/TypeScript#11229
mrcrowl commentedon Jun 16, 2017
Dirk Bäumer (@dbaeumer) would you consider #28912 as an alternative for now?
dbaeumer commentedon Jun 19, 2017
mrcrowl I think having TS exposing its API is useful regardless of this issue.
josh-sachs commentedon Jun 20, 2017
The vsix provided by mrcrowl does EXACTLY what vscode should do by default.
meriturva commentedon Jun 28, 2017
Right now TypeScript 2.4 is landed, but i think there is no news about compileOnSave fix on TS Server or language service. Do we have to wait also VSCode new version to have a productive environment? Vsix from mrcrowl is really a good start (thanks again) but i think that we have to expect an official solution. am i wrong?
bkniffler commentedon Jul 14, 2017
The best solution for me was using a build task and ONLY compile the saved file:
The script will pick up the tsconfig.json compilerOptions. Only downside is that it will not output any errors whatsoever since the process is detached to allow for parallel executions of the task in case multiple files are saved.
xygahs0801 commentedon Aug 29, 2017
I just write a little extension.
https://github.com/xygahs0801/ts-compile-on-save
https://marketplace.visualstudio.com/items?itemName=liuwei.ts-compile-on-save
this will execute ts -w for workspace if it contains the tsconfig.json file.
fuyifan commentedon Sep 20, 2017
xygahs0801 It works great. Thank you very much.
josh-sachs commentedon Sep 20, 2017
It sucks that this issue has been closed, as it doesn't appear any official support addressing this has been provided. Visual Studio seems to do this out of the box, without the need to run a battery draining background process during development.
carlpaten commentedon Sep 26, 2017
Could this issue please be re-opened? It's not exactly resolved.
mjbvz commentedon Sep 26, 2017
LilRed This is issue is still being tracked by #973 and #7342