1# Dart
2
3Dart support is available through the [Dart extension](https://github.com/zed-extensions/dart).
4
5- Tree-sitter: [UserNobody14/tree-sitter-dart](https://github.com/UserNobody14/tree-sitter-dart)
6- Language Server: [dart language-server](https://github.com/dart-lang/sdk)
7
8## Pre-requisites
9
10You will need to install the Dart SDK.
11
12You can install dart from [dart.dev/get-dart](https://dart.dev/get-dart) or via the [Flutter Version Management CLI (fvm)](https://fvm.app/documentation/getting-started/installation)
13
14## Configuration
15
16The dart extension requires no configuration if you have `dart` in your path:
17
18```sh
19which dart
20dart --version
21```
22
23If you would like to use a specific dart binary or use dart via FVM you can specify the `dart` binary in your Zed settings.jsons file:
24
25```json
26{
27 "lsp": {
28 "dart": {
29 "binary": {
30 "path": "/opt/homebrew/bin/fvm",
31 "arguments": ["dart", "language-server", "--protocol=lsp"]
32 }
33 }
34 }
35}
36```
37
38### Formatting
39
40Dart by-default uses a very conservative maximum line length (80). If you would like the dart LSP to permit a longer line length when auto-formatting, add the following to your Zed settings.json:
41
42```json
43{
44 "lsp": {
45 "dart": {
46 "settings": {
47 "lineLength": 140
48 }
49 }
50 }
51}
52```
53
54Please see the Dart documentation for more information on [dart language-server capabilities](https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/tool/lsp_spec/README.md).