Compare commits

..

2 Commits

Author SHA1 Message Date
79788d4ec0 Add space to AWS profile modeline string 2024-04-10 09:44:40 -04:00
6857bb849c Add Astro support 2024-04-10 09:44:40 -04:00
5 changed files with 56 additions and 3 deletions

View 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)

View File

@ -58,9 +58,9 @@
"Displays the current AWS profile in the modeline." :global t "Displays the current AWS profile in the modeline." :global t
(if aws-modeline-mode (if aws-modeline-mode
(add-to-list 'mode-line-misc-info (add-to-list 'mode-line-misc-info
'(:eval (format "AWS:%s " (or aws-current-profile "default")))) '(:eval (format " AWS:%s " (or aws-current-profile "default"))))
(setq mode-line-misc-info (setq mode-line-misc-info
(delete '(:eval (format "AWS:%s " (or aws-current-profile "default"))) (delete '(:eval (format " AWS:%s " (or aws-current-profile "default")))
mode-line-misc-info)))) mode-line-misc-info))))
(add-hook 'after-init-hook #'aws-modeline-mode) (add-hook 'after-init-hook #'aws-modeline-mode)

View File

@ -81,6 +81,7 @@
`((ruby-mode ruby-ts-mode) . ,(eglot-alternatives `((ruby-mode ruby-ts-mode) . ,(eglot-alternatives
'(("srb" "typecheck" "--lsp") '(("srb" "typecheck" "--lsp")
("solargraph" "socket" "--port" :autoport))))) ("solargraph" "socket" "--port" :autoport)))))
;; Sorbet passes an out-of-spec key in its connection JSON, filter it out to prevent eglot blowing up ;; 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) (cl-defun jsonrpc-connection-receive--filter-args ((conn foreign-message) &rest args)
(let ((msg (cl-loop for (k v) on foreign-message by #'cddr (let ((msg (cl-loop for (k v) on foreign-message by #'cddr
@ -88,9 +89,16 @@
collect k and collect v))) collect k and collect v)))
(append (list conn msg) args))) (append (list conn msg) args)))
(advice-add 'jsonrpc-connection-receive :filter-args #'jsonrpc-connection-receive--filter-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 (defvar eglot-java-java-agent nil
"Java agent JVM arg for eglot JDTLS.") "Java agent JVM arg for eglot JDTLS.")
;; Custom eglot java server for deeper customization
(defclass eglot-java-server (eglot-lsp-server) () (defclass eglot-java-server (eglot-lsp-server) ()
:documentation "Eglot integration with JDTLS.") :documentation "Eglot integration with JDTLS.")
(defun eglot-java-contact (&optional interactive) (defun eglot-java-contact (&optional interactive)
@ -228,6 +236,7 @@
(sh-mode . eglot-ensure) (sh-mode . eglot-ensure)
(bash-ts-mode . eglot-ensure) (bash-ts-mode . eglot-ensure)
(yaml-mode . eglot-ensure) (yaml-mode . eglot-ensure)
(astro-ts-mode . eglot-ensure)
:custom :custom
(eglot-confirm-server-initiated-edits nil) (eglot-confirm-server-initiated-edits nil)
(eglot-connect-timeout nil)) (eglot-connect-timeout nil))

View 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)

View File

@ -89,6 +89,7 @@
(require 'init-eshell) (require 'init-eshell)
(require 'init-help) (require 'init-help)
(require 'init-tree-sitter) (require 'init-tree-sitter)
(require 'init-treesit)
(require 'init-python) (require 'init-python)
(require 'init-clojure) (require 'init-clojure)
(require 'init-lisp) (require 'init-lisp)
@ -98,6 +99,7 @@
(require 'init-ruby) (require 'init-ruby)
(require 'init-rust) (require 'init-rust)
(require 'init-web) (require 'init-web)
(require 'init-astro)
(require 'init-xml) (require 'init-xml)
(require 'init-yaml) (require 'init-yaml)
(require 'init-groovy) (require 'init-groovy)