typescript.java icon indicating copy to clipboard operation
typescript.java copied to clipboard

Compile on Save not triggered when adding or removing files

Open lorenzodallavecchia opened this issue 7 years ago • 2 comments

With compile on save enabled, adding or removing entire files in Eclipse is not triggering correct recompilation of other files that may be affected.

This problems applies to the new compilation performed by tsserver.

Investigation and thoughts

When a file is removed in Eclipse, no notification is sent to tsserver. When a file is added in Eclipse, the client is asking for compileOnSaveAffectedFileList, but the server is responding that no files are affected. I think this is caused by the fact that the server was not informed about any actual "change", so it considers the new file unchanged.

The overall supporto for project-level changes seems completely lacking from tsserver: this is probably a result of it being used as backend for tools like VSCode that are still not providing the level of project scope you can see in Eclipse. For example, it is still normal in VSCode to not expect error to be listed for closed files.

Unfortunately, for CoS to be realiable, each delta in the Eclipse workspace must be communicated to tsserver. The client cannot risk to have its incremental state misaligned with the server's. If there is no way of overcoming this in tsserver (is there, Angelo?) the only option I see is to force a compileOnSave of all files when a delta cannot be sent to the server. The price would be worse performance for some operations, but at least the developer could rely on the IDE.

lorenzodallavecchia avatar Feb 09 '17 16:02 lorenzodallavecchia

@lorenzodallavecchia Is Microsoft/TypeScript#17493 somehow related to this?
This should be in Typescript 2.6 in October

probert94 avatar Aug 18 '17 12:08 probert94

Is Microsoft/TypeScript#17493 somehow related to this?

@Springrbua it probably is! It looks like something that would make integration with Eclipse a lot easier. When that feature is released we should probably review how builder deltas are communicated to the server.

lorenzodallavecchia avatar Oct 02 '17 11:10 lorenzodallavecchia