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

default settings should provide dart.lineLength inherited from Zed settings #2

Open
notpeter opened this issue Dec 3, 2024 · 3 comments

Comments

@notpeter
Copy link
Contributor

notpeter commented Dec 3, 2024

The default settings passed to the language server should include line length from Zed settings.

dart.lineLength (int?): Sets a default value for the formatter to wrap code at if no value is specified in formatter.page_width in analysis_options.yaml. If unspecified by both, code will be wrapped at 80 characters.

https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md

@nicpaimnt
Copy link

This is annoying indeed and prevents me to work in Zed.

I'd take any hardcoded option in the meanwhile... I tried editorconfig etc. no use.

@notpeter
Copy link
Contributor Author

Can you try adding this to your settings (worked for me):

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

@notpeter
Copy link
Contributor Author

I'm not sure whether it's possible to this with current Extensions API.
Native Languages can access AllLanguageSettings:

https://github.com/zed-industries/zed/blob/892a0e4c9a26e1fae0a86b7e1bd36608fa681994/crates/languages/src/yaml.rs#L103-L116

But the Extensions API LanguageSettings only includes tab_size

#[derive(Debug, Serialize, Deserialize)]
pub struct LanguageSettings {
    /// How many columns a tab should occupy.
    pub tab_size: NonZeroU32,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants