question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to stop formatter wrapping at 80 characters?

See original GitHub issue

VSCode Version 1.33.1 (1.33.1) Dart 3.02

Whenever code formatting is invoked, it wraps my dart code even though I checked all settings I could find I don’t think it’s a general VSCode issue because the same code in an .m file does not get wrapped.

{
    "dart.flutterSdkPath": "/Applications/flutter",
    "workbench.colorTheme": "Visual Studio Light",
    "editor.formatOnSave": true,
    "editor.minimap.enabled": false,
    "editor.codeLens": false,
    "editor.folding": false,
    "editor.highlightActiveIndentGuide": false,
    "editor.insertSpaces": false,
    "editor.lightbulb.enabled": true,
    "editor.renderIndentGuides": false,
    "editor.overviewRulerBorder": true,
    "editor.hideCursorInOverviewRuler": true,
    "editor.wordWrapColumn": 999,
    "editor.formatOnType": true,
    "editor.wrappingIndent": "none",
    "[dart]": {
        "editor.rulers": [
            0
        ]
    },
}
      final existingEvents = (await deviceCalendar.retrieveEvents(calendar.id, RetrieveEventsParams())).data;
      final newEvents = list.where((x)=>existingEvents.firstWhere((y)=>y.title == x['text']) == null);

Becomes

      final existingEvents = (await deviceCalendar.retrieveEvents(
              calendar.id, RetrieveEventsParams()))
          .data;
      final newEvents = list.where((x) =>
          existingEvents.firstWhere((y) => y.title == x['text']) == null);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

50reactions
DanTupcommented, May 16, 2019

You’re right, this is a Dart setting. For formatting, we use the SDK-supplied dart_style library which wraps lines at 80 characters, but you can control this with the "dart.lineLength" setting.

Let me know if this doesn’t work for you.

6reactions
emri99commented, Dec 7, 2020

Wish this setting could be shared with teammates.

We use editorconfig, however the line length defined in screenshot above overrides property in .editorconfig file.

Have tried such config:

[*]
max_line_length = 120

or

[*.dart]
max_line_length = 120

None is functional.

Is there anything to do to make editorconfig configuration take precedence over dart editor setting ? Any alternative way to share this setting ?

Thanks 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Disable auto wrap long line in Visual Studio Code
If you use autopep8 , do the following: open "Settings"-> search "python formatting autopep8 args" -> click "Add Item" -> type --max-line-length ......
Read more >
VS Code tips — Editor word wrap - YouTube
The "Editor: Word Wrap " setting in VS Code controls the soft wrapping of long lines in the editor:- 'off' — Disable wrapping...
Read more >
Wrap Existing Text at 80 Characters in Vim - Thoughtbot
You have an existing block of text or code in vim. You want to re-format it to wrap to 80-characters. :set textwidth=80.
Read more >
The Black code style - Black 22.12.0 documentation
How Black wraps lines#. Black ignores previous formatting and applies uniform horizontal and vertical whitespace to your code. The rules for horizontal ...
Read more >
Word wrap - Visual Studio (Windows) - Microsoft Learn
You can set and clear the Word wrap option. When this option is set, the portion of a long line that extends beyond...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found