diff --git a/doc/modules/dart.md b/doc/modules/dart.md new file mode 100644 index 0000000..eea12d3 --- /dev/null +++ b/doc/modules/dart.md @@ -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. diff --git a/doc/modules/index.md b/doc/modules/index.md index 2b8902d..2feb6e6 100644 --- a/doc/modules/index.md +++ b/doc/modules/index.md @@ -56,6 +56,7 @@ The following programming languages have enhanced support in Prelude: - CoffeeScript - Common Lisp - CSS +- [Dart](dart.md) - Emacs Lisp - Erlang - Elixir diff --git a/modules/prelude-dart.el b/modules/prelude-dart.el new file mode 100644 index 0000000..070647b --- /dev/null +++ b/modules/prelude-dart.el @@ -0,0 +1,58 @@ +;;; prelude-dart.el --- Emacs Prelude: Dart programming configuration. +;; +;; Copyright © 2011-2020 Bozhidar Batsov +;; +;; Author: Rafael Medina +;; 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 diff --git a/sample/prelude-modules.el b/sample/prelude-modules.el index 806c116..2f90623 100644 --- a/sample/prelude-modules.el +++ b/sample/prelude-modules.el @@ -16,6 +16,7 @@ ;; (require 'prelude-coffee) ;; (require 'prelude-common-lisp) ;; (require 'prelude-css) +;; (require 'prelude-dart) (require 'prelude-emacs-lisp) ;; (require 'prelude-erlang) ;; (require 'prelude-elixir)