Add Astro support
This commit is contained in:
parent
e2f13a1c58
commit
6857bb849c
14
emacs/.emacs.d/config/init-astro.el
Normal file
14
emacs/.emacs.d/config/init-astro.el
Normal file
@ -0,0 +1,14 @@
|
||||
;; -*- lexical-binding: t; -*-
|
||||
|
||||
(use-package astro-ts-mode
|
||||
:mode "\\.astro\\'"
|
||||
:init
|
||||
(with-eval-after-load 'treesit
|
||||
(add-to-list 'treesit-language-source-alist
|
||||
'(astro "https://github.com/virchau13/tree-sitter-astro"))
|
||||
(add-to-list 'treesit-language-source-alist
|
||||
'(css "https://github.com/tree-sitter/tree-sitter-css"))
|
||||
(add-to-list 'treesit-language-source-alist
|
||||
'(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src"))))
|
||||
|
||||
(provide 'init-astro)
|
@ -81,6 +81,7 @@
|
||||
`((ruby-mode ruby-ts-mode) . ,(eglot-alternatives
|
||||
'(("srb" "typecheck" "--lsp")
|
||||
("solargraph" "socket" "--port" :autoport)))))
|
||||
|
||||
;; Sorbet passes an out-of-spec key in its connection JSON, filter it out to prevent eglot blowing up
|
||||
(cl-defun jsonrpc-connection-receive--filter-args ((conn foreign-message) &rest args)
|
||||
(let ((msg (cl-loop for (k v) on foreign-message by #'cddr
|
||||
@ -88,9 +89,16 @@
|
||||
collect k and collect v)))
|
||||
(append (list conn msg) args)))
|
||||
(advice-add 'jsonrpc-connection-receive :filter-args #'jsonrpc-connection-receive--filter-args)
|
||||
|
||||
;; Astro
|
||||
(add-to-list 'eglot-server-programs
|
||||
'(astro-ts-mode . ("astro-ls" "--stdio"
|
||||
:initializationOptions
|
||||
(:typescript (:tsdk "./node_modules/typescript/lib")))))
|
||||
|
||||
;; Custom eglot java server for deeper customization
|
||||
(defvar eglot-java-java-agent nil
|
||||
"Java agent JVM arg for eglot JDTLS.")
|
||||
;; Custom eglot java server for deeper customization
|
||||
(defclass eglot-java-server (eglot-lsp-server) ()
|
||||
:documentation "Eglot integration with JDTLS.")
|
||||
(defun eglot-java-contact (&optional interactive)
|
||||
@ -228,6 +236,7 @@
|
||||
(sh-mode . eglot-ensure)
|
||||
(bash-ts-mode . eglot-ensure)
|
||||
(yaml-mode . eglot-ensure)
|
||||
(astro-ts-mode . eglot-ensure)
|
||||
:custom
|
||||
(eglot-confirm-server-initiated-edits nil)
|
||||
(eglot-connect-timeout nil))
|
||||
|
28
emacs/.emacs.d/config/init-treesit.el
Normal file
28
emacs/.emacs.d/config/init-treesit.el
Normal file
@ -0,0 +1,28 @@
|
||||
;; -*- lexical-binding: t; -*-
|
||||
(use-package treesit
|
||||
:straight (:type built-in)
|
||||
:config
|
||||
(setq treesit-language-source-alist
|
||||
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
(cmake "https://github.com/uyha/tree-sitter-cmake")
|
||||
(css "https://github.com/tree-sitter/tree-sitter-css")
|
||||
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
|
||||
(go "https://github.com/tree-sitter/tree-sitter-go")
|
||||
(html "https://github.com/tree-sitter/tree-sitter-html")
|
||||
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
|
||||
(json "https://github.com/tree-sitter/tree-sitter-json")
|
||||
(make "https://github.com/alemuller/tree-sitter-make")
|
||||
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
|
||||
(python "https://github.com/tree-sitter/tree-sitter-python")
|
||||
(toml "https://github.com/tree-sitter/tree-sitter-toml")
|
||||
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "tsx/src")
|
||||
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "typescript/src")
|
||||
(yaml "https://github.com/ikatyang/tree-sitter-yaml")
|
||||
(astro "https://github.com/virchau13/tree-sitter-astro")))
|
||||
|
||||
(defun treesit-install-all-grammars ()
|
||||
(interactive)
|
||||
(dolist (lang (mapcar #'car treesit-language-source-alist))
|
||||
(treesit-install-language-grammar lang))))
|
||||
|
||||
(provide 'init-treesit)
|
@ -89,6 +89,7 @@
|
||||
(require 'init-eshell)
|
||||
(require 'init-help)
|
||||
(require 'init-tree-sitter)
|
||||
(require 'init-treesit)
|
||||
(require 'init-python)
|
||||
(require 'init-clojure)
|
||||
(require 'init-lisp)
|
||||
@ -98,6 +99,7 @@
|
||||
(require 'init-ruby)
|
||||
(require 'init-rust)
|
||||
(require 'init-web)
|
||||
(require 'init-astro)
|
||||
(require 'init-xml)
|
||||
(require 'init-yaml)
|
||||
(require 'init-groovy)
|
||||
|
Loading…
Reference in New Issue
Block a user