Theia: [editor] Format the text on saved.

Created on 30 Oct 2018  路  6Comments  路  Source: eclipse-theia/theia

When editing in any editors, on saved, the data inside the file should be formatted. The text should be aligned.

All 6 comments

Great suggestion! Having an option to do this would be nice.

This could be used for example to run Prettier on Save (but since this is opinionated, I think it should be a configuration option).

Prettier is designed to be integrated into editors to format on save. It has many existing editor integrations.

Running it automatically on save would be a big help for Shields contributors (badges/shields#2783), and similarly for any other project using Prettier.

Exciting! @paulmelnikow If I understand @lmcbout's pull request correctly, we "just" need to somehow hook the monaco.editor.action.formatDocument action up with Prettier for Shields, and set the editor.formatOnSave preference to true.

EDIT: I'll look into how this can be automated for Shields on Gitpod.

is there a way to format with prettier on save now? Was trying:

"[javascript]": {
    "editor.formatOnSave": true
}

but not working

@sojohnnysaid I think you may also want to install https://github.com/prettier/prettier-vscode in Theia, e.g. by downloading a .vsix file, and by drag-and-dropping it into Theia's extension panel on the left.

EDIT: You could download it from https://open-vsx.org/extension/esbenp/prettier-vscode

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fangnx picture fangnx  路  3Comments

marechal-p picture marechal-p  路  3Comments

Beetix picture Beetix  路  3Comments

cekvenich picture cekvenich  路  3Comments

kpge picture kpge  路  3Comments