mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
feat(kotlin): add treesit support
This commit is contained in:
@ -13,10 +13,14 @@ This module adds [[https://kotlinlang.org/][Kotlin]] support to Doom Emacs.
|
|||||||
- +lsp ::
|
- +lsp ::
|
||||||
Enable LSP support for ~kotlin-mode~. Requires [[doom-module::tools lsp]] and a langserver
|
Enable LSP support for ~kotlin-mode~. Requires [[doom-module::tools lsp]] and a langserver
|
||||||
(supports [[https://github.com/emacs-lsp/lsp-mode][kotlin-language-server]]).
|
(supports [[https://github.com/emacs-lsp/lsp-mode][kotlin-language-server]]).
|
||||||
|
- +tree-sitter ::
|
||||||
|
Leverages tree-sitter for better syntax highlighting and structural text
|
||||||
|
editing. Requires Emacs 29.1+ and [[doom-module::tools tree-sitter]].
|
||||||
|
|
||||||
** Packages
|
** Packages
|
||||||
- [[doom-package:flycheck-kotlin]] if [[doom-module::checkers syntax]]
|
- [[doom-package:flycheck-kotlin]] if [[doom-module::checkers syntax]]
|
||||||
- [[doom-package:kotlin-mode]]
|
- [[doom-package:kotlin-mode]]
|
||||||
|
- [[doom-package:kotlin-ts-mode]]
|
||||||
|
|
||||||
** Hacks
|
** Hacks
|
||||||
/No hacks documented for this module./
|
/No hacks documented for this module./
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
;;; lang/kotlin/config.el -*- lexical-binding: t; -*-
|
;;; lang/kotlin/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(after! kotlin-mode
|
(after! kotlin-mode
|
||||||
(when (modulep! +lsp)
|
|
||||||
(add-hook 'kotlin-mode-local-vars-hook #'lsp! 'append))
|
|
||||||
(set-docsets! 'kotlin-mode "Kotlin")
|
(set-docsets! 'kotlin-mode "Kotlin")
|
||||||
(set-repl-handler! 'kotlin-mode #'kotlin-repl)
|
(set-repl-handler! 'kotlin-mode #'kotlin-repl)
|
||||||
|
|
||||||
|
(when (modulep! +lsp)
|
||||||
|
(add-hook 'kotlin-mode-local-vars-hook #'lsp! 'append))
|
||||||
|
|
||||||
(map! :map kotlin-mode-map
|
(map! :map kotlin-mode-map
|
||||||
:localleader
|
:localleader
|
||||||
:prefix ("b" . "build")
|
:prefix ("b" . "build")
|
||||||
@ -17,3 +18,15 @@
|
|||||||
(use-package! flycheck-kotlin
|
(use-package! flycheck-kotlin
|
||||||
:when (modulep! :checkers syntax -flymake)
|
:when (modulep! :checkers syntax -flymake)
|
||||||
:hook (kotlin-mode . flycheck-kotlin-setup))
|
:hook (kotlin-mode . flycheck-kotlin-setup))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! kotlin-ts-mode
|
||||||
|
:when (modulep! +tree-sitter)
|
||||||
|
:when (fboundp 'treesit-available-p)
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(set-tree-sitter! 'kotlin-mode 'kotlin-ts-mode
|
||||||
|
'((kotlin :url "https://github.com/fwcd/tree-sitter-kotlin")))
|
||||||
|
:config
|
||||||
|
(when (modulep! +lsp)
|
||||||
|
(add-hook 'kotlin-ts-mode-local-vars-hook #'lsp! 'append)))
|
||||||
|
@ -3,5 +3,9 @@
|
|||||||
|
|
||||||
(package! kotlin-mode :pin "fddd747e5b4736e8b27a147960f369b86179ddff")
|
(package! kotlin-mode :pin "fddd747e5b4736e8b27a147960f369b86179ddff")
|
||||||
|
|
||||||
|
(when (and (modulep! +tree-sitter)
|
||||||
|
(fboundp 'treesit-available-p))
|
||||||
|
(package! kotlin-ts-mode :pin "a25d56cecac9160ba7c140f982ec16ca7b2fe97f"))
|
||||||
|
|
||||||
(when (modulep! :checkers syntax -flymake)
|
(when (modulep! :checkers syntax -flymake)
|
||||||
(package! flycheck-kotlin :pin "a2a6abb9a7f85c6fb15ce327459ec3c8ff780188"))
|
(package! flycheck-kotlin :pin "a2a6abb9a7f85c6fb15ce327459ec3c8ff780188"))
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
(java "https://github.com/tree-sitter/tree-sitter-java" nil nil nil nil)
|
(java "https://github.com/tree-sitter/tree-sitter-java" nil nil nil nil)
|
||||||
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src" nil nil)
|
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src" nil nil)
|
||||||
(json "https://github.com/tree-sitter/tree-sitter-json" nil nil nil nil)
|
(json "https://github.com/tree-sitter/tree-sitter-json" nil nil nil nil)
|
||||||
(kotlin "https://github.com/fwcd/tree-sitter-kotlin" nil nil nil nil)
|
|
||||||
(latex "https://github.com/latex-lsp/tree-sitter-latex" nil nil nil nil)
|
(latex "https://github.com/latex-lsp/tree-sitter-latex" nil nil nil nil)
|
||||||
(make "https://github.com/tree-sitter-grammars/tree-sitter-make" nil nil nil nil)
|
(make "https://github.com/tree-sitter-grammars/tree-sitter-make" nil nil nil nil)
|
||||||
(nix "https://github.com/nix-community/tree-sitter-nix" nil nil nil nil)
|
(nix "https://github.com/nix-community/tree-sitter-nix" nil nil nil nil)
|
||||||
|
Reference in New Issue
Block a user