This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/dart
syl20bnr 584392bd92 [core] Fix layer dependencies based on layer variables
There was a edge case with the declaration of the `lsp` layer in `layers.el`
files.
The `hy` layer depends on the `python` layer which in turn depends on the `lsp`
layer if and only if the `python-backend` layer variable is set to `lsp`.
When the `hy` layer was declared first then it declares the `python` layer
without its layer variables, thus the `lsp` layer was not declared because the
`python-backend` variable was not set.

The fix is to gather all the layer dependencies and resolve them only after all
the used layers have been declared.

* new function `configuration-layer/declare-layer-dependencies`
* replace all calls to `configuration-layer/declare-layer` by the new function
  except for distribution layers (we declare layer dependencies right away in
  distribution layers)
2019-09-30 02:00:48 -04:00
..
img
config.el [dart] fix jump handlers 2019-09-24 07:39:37 +02:00
funcs.el [dart] Explain LSP dependency and make layer require LSP layer 2019-09-28 23:01:49 +02:00
layers.el [core] Fix layer dependencies based on layer variables 2019-09-30 02:00:48 -04:00
packages.el [dart] Fix reverting a dart buffer 2019-09-25 10:59:43 +02:00
README.org [dart] Explain LSP dependency and make layer require LSP layer 2019-09-28 23:01:49 +02:00

dart layer

/TakeV/spacemacs/media/commit/da8063437052943f749bc0f14c5ef5a7536aeaac/layers/+lang/dart/img/dart.png

Description

This layer adds support for Dart language, and could be optionally used for Flutter development as well.

Features:

  • Syntax Highlight
  • Error checking with flycheck
  • Go to Definition
  • Dart Analyzer integration
  • Key bindings

Install

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add dart to the existing dotspacemacs-configuration-layers list in this file.

Dart SDK location

The layer itself will use the dart executable location if available on the execution path, but it is possible to define the location manually. It should point to the folder, and end with /.

  (dart :variables dart-server-sdk-path "~/path/to/dart-sdk/")

Flutter integration

Flutter comes with a internal Dart SDK, which can be used to provide all the integration tools.

  (dart :variables dart-server-sdk-path "<flutter-path>/bin/cache/dart-sdk/")

LSP

This layer requires an instance of a dart lsp server to work properly. You can execute below command to install the official dart lsp server. Make sure that the executable is available on your path.

  pub global activate dart_language_server

Configuration

For additional variables check the dart-server documentation.

Format on save

  (dart :variables dart-server-format-on-save t)

Key bindings

Normal mode

Some of the commands will instantiate a new Dart Analyzer server if necessary, while others work without using a Dart Analyzer connection.

When dart-server-enable-analysis-server is enabled, most of the commands become Async, and there might be a delay when executing them.

Key binding Description
SPC m h h, SPC m ? Displays hover information for the current point.
SPC m h b Displays information at point on a new buffer.
gd, SPC m g Go to definition.
SPC m f d Find members declarations by name.
SPC m f r Find members references by name.
SPC m f d Find top-level declarations by name.
SPC m = Format buffer

Insert mode

Key binding Description
<tab> Expand previous word using Analyzer if available
C-<tab> Expand including parameters

Popup screens

Key binding Description
q Close popup
gr Execute last command to repopulate buffer