Add prelude-dart module (#1272)

This commit is contained in:
Rafael Medina 2020-08-22 23:39:15 -06:00 committed by GitHub
parent aa05753b97
commit 2836be0cda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 0 deletions

21
doc/modules/dart.md Normal file
View file

@ -0,0 +1,21 @@
# Prelude Dart
!!! Note
This module builds on top of the lsp-module.
The dart module is powered by [lsp-dart](https://emacs-lsp.github.io/lsp-dart/)
Some features it provides:
- Flutter integration
- Tree views
- Run pub
- Debug
- Run tests
Some commands:
`lsp-dart-pub-get` - Run pub get or flutter pub get on project root.
`lsp-dart-pub-upgrade` - Run pub upgrade or flutter pub upgrade on project root.
`lsp-dart-pub-outdated` - Run pub outdated or flutter pub outdated on project root.
`lsp-dart-run-all-tests` - Run all tests from project.
`lsp-dart-run-test-file` - Run all tests from current test buffer.

View file

@ -56,6 +56,7 @@ The following programming languages have enhanced support in Prelude:
- CoffeeScript - CoffeeScript
- Common Lisp - Common Lisp
- CSS - CSS
- [Dart](dart.md)
- Emacs Lisp - Emacs Lisp
- Erlang - Erlang
- Elixir - Elixir

58
modules/prelude-dart.el Normal file
View file

@ -0,0 +1,58 @@
;;; prelude-dart.el --- Emacs Prelude: Dart programming configuration.
;;
;; Copyright © 2011-2020 Bozhidar Batsov
;;
;; Author: Rafael Medina <rafaelmedina789@gmail.com>
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Some basic configuration for prelude-dart.
;;; License:
;; 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-lsp)
(prelude-require-packages '(lsp-dart))
(with-eval-after-load 'lsp-dart
(add-hook 'dart-mode-hook #'lsp))
(with-eval-after-load 'dart-mode
(defun prelude-dart-mode-defaults ()
(setq dap-launch-configuration-providers '(dap-debug-template-configurations-provider))
;; Add to default dart-mode key bindings
(lsp-dart-define-key "s o" #'lsp-dart-show-outline)
(lsp-dart-define-key "s f" #'lsp-dart-show-flutter-outline)
(dap-dart-setup))
(setq prelude-dart-mode-hook 'prelude-dart-mode-defaults)
(add-hook 'dart-mode-hook (lambda ()
(run-hooks 'prelude-dart-mode-hook))))
(provide 'prelude-dart)
;;; prelude-dart.el ends here

View file

@ -16,6 +16,7 @@
;; (require 'prelude-coffee) ;; (require 'prelude-coffee)
;; (require 'prelude-common-lisp) ;; (require 'prelude-common-lisp)
;; (require 'prelude-css) ;; (require 'prelude-css)
;; (require 'prelude-dart)
(require 'prelude-emacs-lisp) (require 'prelude-emacs-lisp)
;; (require 'prelude-erlang) ;; (require 'prelude-erlang)
;; (require 'prelude-elixir) ;; (require 'prelude-elixir)