Theia: Execute command on save

Created on 23 Jan 2019  路  2Comments  路  Source: eclipse-theia/theia

Would it be possible to define a command to be executed when a file gets saved, perhaps rather even based on the file type? Basically, that would allow for custom formatters or refreshes to be run.

question

Most helpful comment

There is a new preference editor.formatOnSave (as of 0.3.19) which formats files on manual save, based on the same formatting behaviour found in the command Format Document from monaco. If it doesn't meet your needs, you can most certainly be inspired by it's implementation. #4012

All 2 comments

There is a new preference editor.formatOnSave (as of 0.3.19) which formats files on manual save, based on the same formatting behaviour found in the command Format Document from monaco. If it doesn't meet your needs, you can most certainly be inspired by it's implementation. #4012

You can inject MonacoWorkspace and execute a command on onWillSaveTextDocument event.

Was this page helpful?
0 / 5 - 0 ratings