Dart Mode is a major mode for editing Dart files in Emacs.
-
Install dart-mode by cloning this repository.
Add dart-mode.el to your load path.
Add helm-dart.el to your load path to get helm completions for the quick fix feature.
-
The analysis server is turned on by default. To turn it off, add the following to your
.emacsinit file(setq dart-enable-analysis-server nil) -
OPTIONAL: To enable on-the-fly syntax checking, add the following to your
.emacsfile:(add-hook 'dart-mode-hook 'flycheck-mode) -
OPTIONAL: To enable imenu support, add the following to your
.emacsfile:(add-hook 'dart-mode-hook (lambda () (setq imenu-create-index-function #'dart-imenu-index))) -
OPTIONAL: To view the class hierarchy install tree-mode
-
Features & functions: Provides the following functions
- dartfmt: can be called on a save file hook
To vary the line length that dartfmt uses
(setq dartfmt-args (quote ("-l 90"))) will set it to 90 characters. Default is 80 characters. - dart-jump-to-defn: Navigate source code (bound to M-.)
- dart-type-hierarchy: bind to a key and show the type hierachy
- dart-hover-information: bind to key and show dartdocs for the element
- dart-imports: Organizes all of the directives - removes unused imports and sorts directives
- dart-sort-members: Sort all of the directives, unit and class members of the given Dart file.
- helm-dart-quick-fix: apply quick fix (requires helm-dart.el)
- dartfmt: can be called on a save file hook
To vary the line length that dartfmt uses
-
Use company-dart to get intellisense like support.