Improve dart lang module (#2895)

* Use lsp-dart

* Add hover to +flutter flag

* Update README

* Fixes
This commit is contained in:
Eric Dallo 2020-04-13 23:23:44 -03:00 committed by GitHub
parent 1d6f0b3e44
commit afefce8560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 10 deletions

View file

@ -31,11 +31,12 @@ This module has no dedicated maintainers.
** Module Flags ** Module Flags
+ =+lsp= Enable LSP server integration. + =+lsp= Enable LSP server integration.
+ =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter + =+flutter= Adds ~flutter~ integration and some sane defaults for Flutter
development. development along with ~hover~ for desktop development.
** Plugins ** Plugins
+ [[https://github.com/bradyt/dart-mode][dart-mode]] + [[https://github.com/bradyt/dart-mode][dart-mode]]
+ [[https://github.com/amake/flutter.el][flutter.el]] + [[https://github.com/amake/flutter.el][flutter.el]]
+ [[https://github.com/ericdallo/hover.el][hover.el]]
* Prerequisites * Prerequisites
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
@ -85,8 +86,8 @@ flutter doctor # for Dependency check and further instructions
** Dart & Flutter ** Dart & Flutter
On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this On Linux, the installers for Dart and Flutter use the ~/opt~ directory, and this
module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart module assumes that. However, you may set ~lsp-dart-sdk-dir~ to your Dart
install directory, if it differs, to make sure LSP can find the language server install directory and ~flutter-sdk-path~ to you flutter SDK folder, to make sure
included with the Dart SDK. LSP can find the language server included with the Dart SDK.
Alternatively, these variables shouldn't be necessary if you just include Dart Alternatively, these variables shouldn't be necessary if you just include Dart
and Flutter on your `PATH` variable. and Flutter on your `PATH` variable.

View file

@ -6,7 +6,7 @@
:config :config
(when (and (featurep! +flutter) IS-LINUX) (when (and (featurep! +flutter) IS-LINUX)
(when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk")) (when-let (path (doom-glob "/opt/flutter/bin/cache/dart-sdk"))
(setq lsp-dart-sdk-dir path)))) (setq flutter-sdk-path path))))
(use-package! flutter (use-package! flutter
@ -16,3 +16,13 @@
(map! :map dart-mode-map (map! :map dart-mode-map
:localleader :localleader
"r" #'flutter-run-or-hot-reload)) "r" #'flutter-run-or-hot-reload))
(use-package! hover
:when (featurep! +flutter)
:defer t
:config
(map! :map dart-mode-map
:localleader
"h r" #'hover-run-or-hot-reload
"h R" #'hover-run-or-hot-restart))

View file

@ -6,8 +6,3 @@
(unless (executable-find "dart") (unless (executable-find "dart")
(warn! "Dart isn't on PATH.")) (warn! "Dart isn't on PATH."))
(when (featurep! +lsp)
(require 'dart-mode)
(unless (file-readable-p lsp-dart-sdk-dir)
(warn! "LSP Mode can't find lsp-dart-sdk-dir.")))

View file

@ -2,5 +2,10 @@
;;; lang/dart/packages.el ;;; lang/dart/packages.el
(package! dart-mode :pin "04fcd649f1") (package! dart-mode :pin "04fcd649f1")
(when (featurep! +lsp)
(package! lsp-dart :pin "064d47bad3"))
(when (featurep! +flutter) (when (featurep! +flutter)
(package! flutter :pin "ec92a4df84")) (package! flutter :pin "ec92a4df84")
(package! hover :pin "6f9ed1a651"))