emacs: Add QML mode and tree-sitter
Some checks failed
/ check (push) Failing after 1h10m8s

This commit is contained in:
Erwin Boskma 2024-02-15 08:36:05 +01:00
parent e82ece7cba
commit f6173d7fbd
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
2 changed files with 45 additions and 13 deletions

View file

@ -1284,19 +1284,19 @@ Prefer local packages from =node_modules= to global ones
Add support for Elixir with [[https://github.com/elixir-editors/emacs-elixir][elixir-mode]]. The =elixir-format= hook sets up the correct formatter configuration when in a =projectile= project. Add support for Elixir with [[https://github.com/elixir-editors/emacs-elixir][elixir-mode]]. The =elixir-format= hook sets up the correct formatter configuration when in a =projectile= project.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package elixir-mode (use-package elixir-mode
:after eglot :after eglot
:hook ((elixir-format . (lambda () :hook ((elixir-mode . eglot-ensure))
(if (projectile-project-p) ;; ((elixir-format . (lambda ()
(setq elixir-format-arguments ;; (if (projectile-project-p)
(list "--dot-formatter" ;; (setq elixir-format-arguments
(concat (locate-dominating-file buffer-file-name ".formatter.exs") ".formatter.exs"))) ;; (list "--dot-formatter"
(setq elixir-format-arguments nil)))) ;; (concat (locate-dominating-file buffer-file-name ".formatter.exs") ".formatter.exs")))
(elixir-mode . (lambda () (add-hook 'before-save-hook 'elixir-format nil t))) ;; (setq elixir-format-arguments nil))))
(elixir-mode . eglot-ensure)) ;; (elixir-mode . (lambda () (add-hook 'before-save-hook 'elixir-format nil t)))
:config :config
;; (setq lsp-elixir-server-command '("elixir-ls")) ;; (setq lsp-elixir-server-command '("elixir-ls"))
(add-to-list 'auto-mode-alist '("\\.[hl]eex\\'" . elixir-mode))) (add-to-list 'auto-mode-alist '("\\.[hl]eex\\'" . elixir-mode)))
#+end_src #+end_src
Add a [[https://github.com/ayrat555/mix.el][mix]] minor mode to call =mix= tasks from emacs. Add a [[https://github.com/ayrat555/mix.el][mix]] minor mode to call =mix= tasks from emacs.
@ -1460,6 +1460,26 @@ Enable clangd LSP for C and C++
((c++-mode c++-ts-mode) . eglot-ensure)) ((c++-mode c++-ts-mode) . eglot-ensure))
#+end_src #+end_src
Add some flags to clangd
#+begin_src emacs-lisp
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'((c-mode c-ts-mode c++-mode c++-ts-mode)
. ("clangd"
"--malloc-trim"
"--log=error"
"--clang-tidy"
"--completion-style=detailed"))))
#+end_src
Add QML mode
#+begin_src emacs-lisp
(use-package qml-mode
:mode "\\.qml\\'")
#+end_src
Enable and configure =auto-insert-mode= for Horus projects Enable and configure =auto-insert-mode= for Horus projects
#+begin_src emacs-lisp #+begin_src emacs-lisp

View file

@ -38,6 +38,17 @@ let
}; };
}; };
tree-sitter-qml = pkgs.tree-sitter.buildGrammar {
language = "tree-sitter-qmljs";
version = "unstable-2024-02-02";
src = pkgs.fetchFromGitHub {
owner = "yuja";
repo = "tree-sitter-qmljs";
rev = "9fa49ff3315987f715ce5666ff979a7742fa8a98";
sha256 = "q20gLVLs0LpqRpgo/qNRDfExbWXhICWZjM1ux4+AT6M=";
};
};
emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage { emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage {
config = config =
let let
@ -98,6 +109,7 @@ let
tree-sitter-nu tree-sitter-nu
tree-sitter-pioasm tree-sitter-pioasm
tree-sitter-python tree-sitter-python
tree-sitter-qml
tree-sitter-query tree-sitter-query
tree-sitter-regex tree-sitter-regex
tree-sitter-rst tree-sitter-rst