Fixed issues addressed by @hlissner on #2549.
This commit is contained in:
parent
aefb0672b4
commit
2b47b1e99a
4 changed files with 67 additions and 23 deletions
|
@ -1,6 +1,6 @@
|
||||||
#+TITLE: lang/dart
|
#+TITLE: lang/dart
|
||||||
#+DATE: February 16, 2020
|
#+DATE: February 16, 2020
|
||||||
#+SINCE: February 16, 2020
|
#+SINCE: v3.0.0
|
||||||
#+STARTUP: inlineimages nofold
|
#+STARTUP: inlineimages nofold
|
||||||
|
|
||||||
* Table of Contents :TOC_3:noexport:
|
* Table of Contents :TOC_3:noexport:
|
||||||
|
@ -9,6 +9,8 @@
|
||||||
- [[#module-flags][Module Flags]]
|
- [[#module-flags][Module Flags]]
|
||||||
- [[#plugins][Plugins]]
|
- [[#plugins][Plugins]]
|
||||||
- [[#prerequisites][Prerequisites]]
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#installing-dart-sdk][Installing Dart SDK]]
|
||||||
|
- [[#installing-flutter-sdk][Installing Flutter SDK]]
|
||||||
- [[#features][Features]]
|
- [[#features][Features]]
|
||||||
- [[#configuration][Configuration]]
|
- [[#configuration][Configuration]]
|
||||||
- [[#dart--flutter][Dart & Flutter]]
|
- [[#dart--flutter][Dart & Flutter]]
|
||||||
|
@ -16,14 +18,18 @@
|
||||||
- [[#troubleshooting][Troubleshooting]]
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
|
[[https://dart.dev/][Dart]] is a client-optimized language by Google for fast apps on any platform.
|
||||||
|
It is fast and optimized for UI, Famous for the [[https://flutter.io/][Flutter]] framework, also
|
||||||
|
made by Google. Both Flutter and Dart are free and open-source.
|
||||||
|
|
||||||
|
** Maintainers
|
||||||
|
This module has no dedicated maintainers.
|
||||||
|
|
||||||
|
** Module Flags
|
||||||
The `dart` module wraps `dart-mode`, with LSP code completion for `.dart` files,
|
The `dart` module wraps `dart-mode`, with LSP code completion for `.dart` files,
|
||||||
syntax highlighting, etc. Included is a `+lsp` flag for enabling LSP features,
|
syntax highlighting, etc. Included is a `+lsp` flag for enabling LSP features,
|
||||||
and a `+flutter` flag for working with Flutter.
|
and a `+flutter` flag for working with Flutter.
|
||||||
|
|
||||||
** Maintainers
|
|
||||||
+ @sevensidedmarble (Author)
|
|
||||||
|
|
||||||
** Module Flags
|
|
||||||
+ =+lsp= Will start LSP automatically in `dart-mode-hook`.
|
+ =+lsp= Will start LSP automatically in `dart-mode-hook`.
|
||||||
+ =+flutter= Adds the `flutter` package and some settings for Flutter development.
|
+ =+flutter= Adds the `flutter` package and some settings for Flutter development.
|
||||||
|
|
||||||
|
@ -35,6 +41,42 @@ and a `+flutter` flag for working with Flutter.
|
||||||
Make sure that the Dart SDK is on your `PATH`, and if using Flutter, make sure
|
Make sure that the Dart SDK is on your `PATH`, and if using Flutter, make sure
|
||||||
the Flutter binary is on your `PATH` as well.
|
the Flutter binary is on your `PATH` as well.
|
||||||
|
|
||||||
|
** Installing Dart SDK
|
||||||
|
Before starting note that Flutter SDK will have a version of Dart. Therefore,
|
||||||
|
there is no need to install Dart. If you want to use Flutter just see
|
||||||
|
the next part.
|
||||||
|
|
||||||
|
The stable version of the SDK is in most major distributions repositories.
|
||||||
|
If you find it necessary to install any other version or build from source,
|
||||||
|
please refer to the official website at: https://dart.dev/get-dart
|
||||||
|
|
||||||
|
On Debian (also Ubuntu and its derivations), you can simply install the SDK via:
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
sudo apt-get install dart
|
||||||
|
#+END_SRC
|
||||||
|
Or on Arch (and its derivations, like Manjaro), you can install it using:
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
sudo pacman -S dart
|
||||||
|
#+END_SRC
|
||||||
|
And finally in MacOS, the [[https://brew.sh/][Homebrew]] can come in handy. If you have it installed
|
||||||
|
just run:
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
brew tap dart-lang/dart
|
||||||
|
brew install dart#+END_SRC
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Installing Flutter SDK
|
||||||
|
Due to complications with permissions, it is suggested not to use AUR or any
|
||||||
|
automatic installation tools for Flutter SDK.
|
||||||
|
|
||||||
|
On any system just run the following commands to install Flutter, once you have
|
||||||
|
met dependencies named on [[https://flutter.dev/docs/get-started/install/][the site]]:
|
||||||
|
#+BEGIN_SRC shell
|
||||||
|
git clone https://github.com/flutter/flutter --branch stable # to download Flutter
|
||||||
|
export PATH="$PATH:$(pwd)/flutter/bin" # to add it to PATH
|
||||||
|
flutter doctor # for Dependency check and further instructions
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
* Features
|
* Features
|
||||||
+ Syntax highlighting and formatting for `.dart` files provided by LSP
|
+ Syntax highlighting and formatting for `.dart` files provided by LSP
|
||||||
+ Emacs functions for running and debugging Flutter projects
|
+ Emacs functions for running and debugging Flutter projects
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
;;; lang/dart/config.el -*- lexical-binding: t; -*-
|
;;; lang/dart/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(use-package! dart-mode
|
(after! dart-mode
|
||||||
|
(when (featurep! +lsp)
|
||||||
|
(add-hook 'dart-mode-local-vars-hook #'lsp!)
|
||||||
|
(when (and (featurep! +flutter) IS-LINUX)
|
||||||
|
(when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk"))
|
||||||
|
(setq lsp-dart-sdk-dir path)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! flutter
|
||||||
|
:when (featurep! +flutter)
|
||||||
:defer t
|
:defer t
|
||||||
:config
|
:config
|
||||||
(when (and (featurep! +flutter) IS-LINUX)
|
(map! :map dart-mode-map
|
||||||
(setq lsp-dart-sdk-dir "/opt/flutter/bin/cache/dart-sdk/"))
|
:localleader
|
||||||
(when (featurep! +lsp)
|
"r" #'flutter-run-or-hot-reload))
|
||||||
(add-hook 'dart-mode-local-vars-hook #'lsp!)))
|
|
||||||
|
|
||||||
|
|
||||||
(when (featurep! +flutter)
|
|
||||||
(use-package! flutter
|
|
||||||
:defer t
|
|
||||||
:config
|
|
||||||
(map! :map dart-mode-map
|
|
||||||
:localleader
|
|
||||||
"r" #'flutter-run-or-hot-reload)))
|
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
(unless (executable-find "dart")
|
(unless (executable-find "dart")
|
||||||
(warn! "Dart isn't on PATH."))
|
(warn! "Dart isn't on PATH."))
|
||||||
|
|
||||||
(unless (file-readable-p lsp-dart-sdk-dir)
|
(when (featurep! +lsp)
|
||||||
(warn! "LSP Mode can't find lsp-dart-sdk-dir."))
|
(require 'dart-mode)
|
||||||
|
(unless (file-readable-p lsp-dart-sdk-dir)
|
||||||
|
(warn! "LSP Mode can't find lsp-dart-sdk-dir.")))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; lang/dart/packages.el
|
;;; lang/dart/packages.el
|
||||||
|
|
||||||
(package! dart-mode)
|
(package! dart-mode :pin "04fcd649f1")
|
||||||
(when (featurep! +flutter)
|
(when (featurep! +flutter)
|
||||||
(package! flutter))
|
(package! flutter :pin "ec92a4df84"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue