2018-09-04 13:45:10 +00:00
|
|
|
;;; packages.el --- dart layer packages file for Spacemacs.
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2018-09-04 13:45:10 +00:00
|
|
|
;;
|
|
|
|
;; Author: Bruno Tavares <connect+spacemacs@bltavares.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-09-04 13:45:10 +00:00
|
|
|
|
|
|
|
(defconst dart-packages
|
2019-08-09 20:07:07 +00:00
|
|
|
'(
|
|
|
|
dart-mode
|
2019-12-20 22:20:59 +00:00
|
|
|
(dart-server :toggle (eq dart-backend 'analyzer))
|
|
|
|
(flutter (eq dart-backend 'analyzer))
|
2019-08-09 20:07:07 +00:00
|
|
|
flycheck
|
2020-04-23 17:33:15 +00:00
|
|
|
(lsp-dart (eq dart-backend 'lsp))
|
2019-08-09 20:07:07 +00:00
|
|
|
))
|
2018-09-04 13:45:10 +00:00
|
|
|
|
|
|
|
(defun dart/show-buffer ()
|
2019-08-09 20:07:07 +00:00
|
|
|
"Shows information at point in a new buffer"
|
2018-09-04 13:45:10 +00:00
|
|
|
(interactive)
|
2019-08-09 20:07:07 +00:00
|
|
|
(dart-server-show-hover t))
|
|
|
|
|
2019-09-25 08:40:05 +00:00
|
|
|
(defun dart/init-dart-mode ()
|
|
|
|
(use-package dart-mode
|
|
|
|
:defer t
|
|
|
|
:mode "\\.dart\\'"
|
|
|
|
:init
|
|
|
|
(add-hook 'dart-mode-local-vars-hook
|
2019-12-17 05:53:49 +00:00
|
|
|
#'spacemacs//dart-setup-backend)))
|
2018-09-04 13:45:10 +00:00
|
|
|
|
2019-08-09 20:07:07 +00:00
|
|
|
(defun dart/init-dart-server ()
|
|
|
|
(use-package dart-server
|
2019-12-17 05:53:49 +00:00
|
|
|
:defer t
|
|
|
|
:config
|
2018-09-04 13:45:10 +00:00
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'dart-mode "mf" "find")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'dart-mode "mh" "help")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'dart-mode
|
2019-08-09 20:07:07 +00:00
|
|
|
"=" 'dart-server-format
|
|
|
|
"?" 'dart-server-show-hover
|
|
|
|
"g" 'dart-server-goto
|
|
|
|
"hh" 'dart-server-show-hover
|
2018-09-04 13:45:10 +00:00
|
|
|
"hb" 'dart/show-buffer
|
2019-08-09 20:07:07 +00:00
|
|
|
;; There's an upstream issue with this command:
|
|
|
|
;; dart-server-find-refs on int opens a dart buffer that keeps growing in size #11
|
|
|
|
;; https://github.com/bradyt/dart-server/issues/11
|
2019-09-24 05:48:55 +00:00
|
|
|
;; When/if it's fixed, add back the key binding:
|
|
|
|
;; ~SPC m f f~ Find reference at point.
|
|
|
|
;; to the readme.org key binding table.
|
2019-08-09 20:07:07 +00:00
|
|
|
;; "ff" 'dart-server-find-refs
|
|
|
|
"fe" 'dart-server-find-member-decls
|
|
|
|
"fr" 'dart-server-find-member-refs
|
|
|
|
"fd" 'dart-server-find-top-level-decls)
|
2018-09-04 13:45:10 +00:00
|
|
|
|
2019-09-24 05:39:37 +00:00
|
|
|
(add-to-list 'spacemacs-jump-handlers-dart-mode
|
2019-08-09 20:07:07 +00:00
|
|
|
'(dart-server-goto :async t))
|
2018-09-04 13:45:10 +00:00
|
|
|
|
2019-08-09 20:07:07 +00:00
|
|
|
(evil-define-key 'insert dart-server-map
|
|
|
|
(kbd "<tab>") 'dart-server-expand
|
|
|
|
(kbd "C-<tab>") 'dart-server-expand-parameters)
|
2018-09-04 13:45:10 +00:00
|
|
|
|
2019-08-09 20:07:07 +00:00
|
|
|
(evil-set-initial-state 'dart-server-popup-mode 'motion)
|
|
|
|
(evil-define-key 'motion dart-server-popup-mode-map
|
2019-09-25 08:40:05 +00:00
|
|
|
(kbd "gr") 'dart-server-do-it-again))))
|
2018-09-04 13:45:10 +00:00
|
|
|
|
2019-09-21 15:49:05 +00:00
|
|
|
(defun dart/init-flutter ()
|
|
|
|
(use-package flutter
|
|
|
|
:defer t
|
|
|
|
:after dart-mode
|
2019-12-17 05:53:49 +00:00
|
|
|
:config
|
2019-09-21 15:49:05 +00:00
|
|
|
(progn
|
2019-08-09 20:07:07 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'dart-mode "mx" "flutter")
|
2019-09-21 15:49:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'dart-mode
|
2019-08-09 20:07:07 +00:00
|
|
|
"xx" 'flutter-run-or-hot-reload))))
|
2019-09-21 15:49:05 +00:00
|
|
|
|
2020-04-23 17:33:15 +00:00
|
|
|
(defun dart/init-lsp-dart ()
|
|
|
|
(use-package lsp-dart
|
|
|
|
:defer t))
|
|
|
|
|
2018-12-17 16:34:49 +00:00
|
|
|
(defun dart/post-init-flycheck ()
|
|
|
|
(spacemacs/enable-flycheck 'dart-mode))
|