Visual Studio Code and TSLint: Code wrap to more than 80 characters
I found the easiest way which worked for me. Go into settings search for Print Width
and set Prettier: Print Width
to according to your need, by default it's 80 I changed it to 150 and it works for me. And add following in your settings.json
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 150,
"prettier.printWidth": 150
These two should be enough:
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 100
Seems like "editor.wordWrap"
is missing in your settings. In vscode this setting controls wrapping policy: "wordWrapColumn" means wrap at "editor.wordWrapColumn"
setting.
You can also try "editor.wordWrap": "bounded"
which will respect "wordWrapColumn", but also wrap if your viewport is less than nuber of columns you define.
UPD: Based on our discussion in comments, it seems that prettier do not respect its "printWidth"
settings. There might be two most probable reasons:
- This issue: https://github.com/prettier/prettier-vscode/issues/595
- Priorities for defining configuration options: https://github.com/prettier/prettier-vscode#prettiers-settings. In particular, it first searches for prettier config files, than for .editorconfig files, and only then for vscode settings.
As a workaround you can try to actually define this setting in prettier config file for your project, or in editorconfig file and check if vscode plugin will work with either of those.