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

Preferred line length not being used with Dart files #21448

Closed
1 task done
Zambrella opened this issue Dec 3, 2024 · 5 comments
Closed
1 task done

Preferred line length not being used with Dart files #21448

Zambrella opened this issue Dec 3, 2024 · 5 comments
Labels
bug [core label] dart Dart programming language support good first issue Issue suitable for first-time contributors language server An umbrella label for all language servers

Comments

@Zambrella
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I'm writing Dart and I can't get Zed to use my preferred line length. It is using the default 80. This problem is only with Dart files and all other LSP related stuff is working with Dart no problem. Is there something I'm missing?

This is my settings.json:

{
  "assistant": {
    "default_model": {
      "provider": "copilot_chat",
      "model": "gpt-4o"
    },
    "version": "2"
  },
  "telemetry": {
    "metrics": false
  },
  "base_keymap": "VSCode",
  "theme": {
    "mode": "system",
    "light": "Ayu Light",
    "dark": "Ayu Mirage"
  },
  "buffer_font_size": 18,
  "buffer_font_family": "Monaspace Neon",
  "vim_mode": true,
  "formatter": "language_server",
  "inlay_hints": {
    "enabled": true,
    "type_hints": true,
    "show_type_hints": false,
    "show_parameter_hints": false,
    "show_other_hints": true
  },
  "hour_format": "hour24",
  "preferred_line_length": 140,
  "relative_line_numbers": true,
  "tab_bar": {
    "show": true,
    "show_nav_history_buttons": false
  },
  "languages": {
    "Dart": {
      "preferred_line_length": 140
    },
    "Python": {
      "format_on_save": {
        "language_server": {
          "name": "ruff"
        }
      },
      "formatter": {
        "language_server": {
          "name": "ruff"
        }
      },
      "language_servers": [
        "pyright",
        "ruff"
      ]
    }
  },
  "lsp": {
    "dart": {
      "initialization_options": {
        "dart.lineLength": 140
      }
    }
  }
}

Environment

Zed: v0.164.1 (Zed Preview)
OS: macOS 15.1.1
Memory: 16 GiB
Architecture: aarch64

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

No response

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

Zed.log
2024-12-03T10:02:04.374028Z [INFO] ========== starting zed ==========
2024-12-03T10:02:04.441968Z [INFO] Opening main db
2024-12-03T10:02:04.443733Z [INFO] Opening main db
2024-12-03T10:02:04.467714Z [INFO] Using git binary path: Some("/Applications/Zed Preview.app/Contents/MacOS/git")
2024-12-03T10:02:04.707505Z [INFO] set environment variables from ...
2024-12-03T10:02:04.712395Z [INFO] Prompt template overrides directory found at /Users/douglastodd/.config/zed/prompt_overrides.
2024-12-03T10:02:04.713219Z [INFO] extensions updated. loading 10, reloading 0, unloading 0
2024-12-03T10:02:04.793367Z [INFO] Opening main db
2024-12-03T10:02:04.819624Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.819696Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.819743Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.819804Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.81985Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.819901Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.819943Z [ERROR] failed to parse snippet

Caused by:
    expected an integer
2024-12-03T10:02:04.822835Z [INFO] building git repository, `.git` path in the worktree: ".git"
2024-12-03T10:02:04.851385Z [INFO] set status on client 0: Authenticating
2024-12-03T10:02:04.85221Z [INFO] Opening main db
2024-12-03T10:02:04.856121Z [INFO] set status on client 67067: Connecting
2024-12-03T10:02:04.856759Z [INFO] Opening main db
2024-12-03T10:02:04.916827Z [INFO] attempting to start language server "yaml-language-server", path: "/Users/douglastodd/Projects/stash_hub", id: 1
2024-12-03T10:02:04.917377Z [INFO] fetching latest version of language server "yaml-language-server"
2024-12-03T10:02:04.994508Z [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-12-03T10:02:05.288015Z [INFO] using project environment variables shell launched in "/Users/douglastodd/Projects/stash_hub". ...
2024-12-03T10:02:05.593691Z [INFO] add_connection;
2024-12-03T10:02:05.594063Z [INFO] set status on client 67067: Connected { peer_id: PeerId { owner_id: 616, id: 7082547 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-12-03T10:02:05.89858Z [INFO] attempting to start language server "dart", path: "/Users/douglastodd/Projects/stash_hub", id: 2
2024-12-03T10:02:05.898681Z [INFO] attempting to start language server "snippet-completion-server", path: "/Users/douglastodd/Projects/stash_hub", id: 3
2024-12-03T10:02:05.89985Z [INFO] starting language server process. binary path: "/Users/douglastodd/fvm/default/bin/dart", working directory: "/Users/douglastodd/Projects/stash_hub", args: ["language-server", "--protocol=lsp"]
2024-12-03T10:02:06.215953Z [INFO] starting language server process. binary path: "/Users/douglastodd/Library/Application Support/Zed/extensions/work/snippets/simple-completion-language-server-v0.1.1/simple-completion-language-server", working directory: "/Users/douglastodd/Projects/stash_hub", args: []
2024-12-03T10:02:07.386507Z [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/", args: ["/Users/douglastodd/Library/Application Support/Zed/copilot/copilot-v0.7.0/dist/language-server.js", "--stdio"]
2024-12-03T10:02:07.51937Z [WARN] unhandled capability registration: Registration { id: "3", method: "workspace/didChangeConfiguration", register_options: None }
2024-12-03T10:02:07.72392Z [INFO] downloading language server "yaml-language-server"
2024-12-03T10:02:07.962491Z [INFO] Language server with id 0 sent unhandled notification window/logMessage:
{
  "type": 3,
  "message": "[lsp] GitHub Copilot Language Server 1.236.0 initialized"
}
2024-12-03T10:02:07.962563Z [INFO] Language server with id 0 sent unhandled notification workspace/configuration:
{
  "items": [
    {
      "section": "github.copilot"
    },
    {
      "section": "github-enterprise"
    },
    {
      "section": "http"
    },
    {
      "section": "telemetry"
    }
  ]
}
2024-12-03T10:02:08.044175Z [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/Users/douglastodd/Projects/stash_hub", args: ["/Users/douglastodd/Library/Application Support/Zed/languages/yaml-language-server/node_modules/yaml-language-server/bin/yaml-language-server", "--stdio"]
2024-12-03T10:02:08.095163Z [INFO] Language server with id 0 sent unhandled notification window/logMessage:
{
  "type": 3,
  "message": "[certificates] Removed 8 expired certificates"
}
2024-12-03T10:02:08.261391Z [WARN] Generic lsp request to dart failed: File is not being analyzed
2024-12-03T10:02:08.261544Z [ERROR] inlay hint update task for range failed: Error {
    context: "inlay hint fetch task",
    source: Error {
        context: "inlay hints LSP request",
        source: "File is not being analyzed",
    },
}
2024-12-03T10:02:08.317484Z [WARN] unhandled capability registration: Registration { id: "6b1fc2f6-9553-47fe-9560-65f49e05ea64", method: "workspace/didChangeWorkspaceFolders", register_options: Some(Object {}) }
2024-12-03T10:02:08.317655Z [WARN] unhandled capability registration: Registration { id: "e8506f2d-be75-484d-9469-3f952f998747", method: "workspace/didChangeConfiguration", register_options: Some(Object {}) }
2024-12-03T10:02:08.378181Z [INFO] Language server with id 0 sent unhandled notification featureFlagsNotification:
{
  "rt": false,
  "sn": false,
  "chat": true,
  "ic": true,
  "ep": false,
  "pc": false,
  "x": true
}
2024-12-03T10:02:08.378298Z [INFO] Language server with id 0 sent unhandled notification conversation/preconditionsNotification:
{
  "results": [
    {
      "type": "chat_enabled",
      "status": "ok"
    }
  ],
  "status": "ok"
}
2024-12-03T10:02:08.681719Z [WARN] Generic lsp request to dart failed: File is not being analyzed
2024-12-03T10:02:08.681901Z [WARN] Generic lsp request to dart failed: File is not being analyzed
2024-12-03T10:02:08.681977Z [ERROR] inlay hint update task for range failed: Error {
    context: "inlay hint fetch task",
    source: Error {
        context: "inlay hints LSP request",
        source: "File is not being analyzed",
    },
}
2024-12-03T10:02:08.682216Z [ERROR] inlay hint update task for range failed: Error {
    context: "inlay hint fetch task",
    source: Error {
        context: "inlay hints LSP request",
        source: "File is not being analyzed",
    },
}
@Zambrella Zambrella added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Dec 3, 2024
@notpeter
Copy link
Member

notpeter commented Dec 3, 2024

Broken Suggestion

Can you try with:

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

@notpeter notpeter added language server An umbrella label for all language servers dart Dart programming language support and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 3, 2024
@Zambrella

This comment was marked as resolved.

@notpeter notpeter added the good first issue Issue suitable for first-time contributors label Dec 5, 2024
@notpeter
Copy link
Member

Try this, it worked for me:

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

@Zambrella
Copy link
Author

Try this, it worked for me:

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

This is working for me too. Thanks a lot for sharing!

@notpeter
Copy link
Member

I've documented this in the Zed Dart docs and opened:

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] dart Dart programming language support good first issue Issue suitable for first-time contributors language server An umbrella label for all language servers
Projects
None yet
Development

No branches or pull requests

2 participants