Reputation: 3498
No matter what I did, I can't set the line to be bigger than 80 characters. I went in settings and set all to 160, but to no avail. I have prettier, but I don't know how to see its config file. Do you know how to enlarge the maximum line length? I am developing typescript (angular to be precise).
Upvotes: 67
Views: 188486
Reputation: 1126
It was driving me crazy until I discovered it was an extension. In my case HTML extension, with the Wrap Line Length setting.
You can find it in the settings.json file as
html.format.wrapLineLength
To find this out, I inputted text to find the maximun allowed for one line (120 in my case), then I searched that value in my settings file.
Regards.
Upvotes: 3
Reputation: 1259
I use Dart language with VSCode. I tried to set the line length to 100 at various places through the File/preferences/settings dialog, but all of them failed. Finally this is what worked: I edited the settings.json file and adjusted the following entries:
"[dart]": {
"editor.rulers": [
100
],
"editor.wordWrapColumn": 100,
"prettier.printWidth": 100,
"dart.lineLength": 100,
"editor.rulers": [
100
]
Upvotes: 11
Reputation: 163
with Prettier, note that one can modify printWidth
without a .prettierrc
file. Simply navigate to Settings (UI) -> Prettier: Print Width
, and the column width value can be changed directly from there. This is what fixed it for me. :)
Upvotes: 4
Reputation: 357
If you are using .prettierrc
file in your project, specify the line length that the printer will wrap on by including the printWidth
option with a value of your choice:
"printWidth": 120 // default is 80
Consider reading this reference before changing this option.
Upvotes: 13
Reputation: 446
the latest version of visual studio code (or codium) seems to handle multiple wrap lines.
in settings.json
for example:
"editor.rulers": [100, 120, 140]
Upvotes: 31
Reputation: 898
As of 2022 (or probably earlier), you can use "prettier.printWidth: 80" in your settings.json (Change value according to preferences). Follow link for more details. Hope this helped
Upvotes: 10
Reputation: 2411
VSCode does soft wrapping (changing how long lines are displayed).
Prettier does hard wrapping (adding or removing newlines in the text content to try to get a certain length).
VSCode has chosen to leave hard wrapping to extensions but none of the ones I've tried work.
Prettier is deliberately not configurable, and its most stupid rule joins short lines into longer ones (which is why I prefer Eslint).
Upvotes: 15
Reputation: 5919
To completely disable the wrapping:
Settings > Editor: Word Wrap > Off
To set the wrapping to the 160th column:
Settings > Editor: Word Wrap > wordWrapColumn
Settings > Editor: Word Wrap Column > 160
Or add the following to your settings.json
:
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 160
You can open the settings file by pressing F1 and typing settings.json
.
Upvotes: 91