Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As of today format_on_save is not respecting preferred_line_length #15364

Closed
1 task done
DanceParty opened this issue Jul 28, 2024 · 4 comments
Closed
1 task done

As of today format_on_save is not respecting preferred_line_length #15364

DanceParty opened this issue Jul 28, 2024 · 4 comments
Labels
can't reproduce Issue that can't be reproduced (transient, invalid, etc) support User support (non-defect troubleshooting, documentation, etc)

Comments

@DanceParty
Copy link

DanceParty commented Jul 28, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When I make a change in a file, now suddently, the entire file is formatted to match the default line length of 80 even though I have 114 set as my preferred length. Not sure how to reproduce, since it just started happening today when I opened my editor.

Environment

Zed: v0.145.1 (Zed)
OS: macOS 14.5.0
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  "features": {
    "copilot": false
  },
  "base_keymap": "VSCode",
  "preferred_line_length": 114,
  "format_on_save": "on",
  "show_wrap_guides": true,
  "soft_wrap": "none",
  "buffer_line_height": {
    "custom": 1.5
  },
  "theme": "Nanowise Galaxy",
  // "theme": "Atelier Forest Light",
  "ui_font_size": 14,
  // "buffer_font_size": 16,
  "buffer_font_size": 16,
  "buffer_font_family": "Dank Mono",
  "buffer_font_features": {
    "liga": false
  },
  "scrollbar": {
    "show": "system"
  },
  "cursor_blink": false
}

If applicable, attach your Zed.log file to this issue.

Zed.log
2024-07-28T03:04:25.74119Z [INFO] starting language servers for JSON: json-language-server, package-version-server
2024-07-28T03:04:34.431935Z [WARN] Generic lsp request to node failed: Unhandled method textDocument/definition
2024-07-28T03:04:34.58539Z [WARN] Generic lsp request to node failed: Unhandled method textDocument/definition
2024-07-28T03:04:45.081614Z [INFO] Initializing default prettier with plugins {}
2024-07-28T03:04:45.081799Z [INFO] starting language servers for TypeScript: vtsls, eslint
2024-07-28T03:04:45.127968Z [INFO] Language server with id 7 sent unhandled notification eslint/noLibrary:
{
  "source": {
    "uri": "file:///Users/.../app/data/category-client.server.ts"
  }
}
2024-07-28T03:04:46.109477Z [INFO] Initializing default prettier with plugins {}
2024-07-28T03:04:46.109648Z [INFO] starting language servers for TypeScript: vtsls, eslint
2024-07-28T03:04:46.150412Z [INFO] Language server with id 7 sent unhandled notification eslint/noLibrary:
@DanceParty DanceParty added admin read bug [core label] labels Jul 28, 2024
@DanceParty
Copy link
Author

Randomly this seems to have resolved. Maybe some language server wasn't finished loading...?

@notpeter notpeter added can't reproduce Issue that can't be reproduced (transient, invalid, etc) support User support (non-defect troubleshooting, documentation, etc) and removed bug [core label] triage labels Jul 28, 2024
@hareshgediya
Copy link

Getting same issues on Dart, Maybe language issues or Zed?

@colinbes
Copy link

I have same issue, my code always wraps on column 80 on save. I do want to format on save option but 80 columns is too low a number.

I have the following setting in both my local project folder .zed/settings.json and global ~/.config/zed/settings.json:

"languages": {
    "Dart": {
      "preferred_line_length": 150,
      "soft_wrap": "preferred_line_length",
      "tab_size": 2
    }
  },

Note that changing tab_size and switching soft_wrap to editor width does work.

@colinbes
Copy link

Adding this worked!

https://zed.dev/docs/languages/dart#formatting

{
  "lsp": {
    "dart": {
      "settings": {
        "lineLength": 140
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't reproduce Issue that can't be reproduced (transient, invalid, etc) support User support (non-defect troubleshooting, documentation, etc)
Projects
None yet
Development

No branches or pull requests

4 participants