dotfiles/emacs-lisp/java.org
magic_rb a28d05e6c4
Emacs java
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-03-20 12:35:42 +01:00

1.2 KiB

Java

  (use-package lsp-java
    :straight t
     :config
     (defun lsp-envrc-mode-setup ()
       (when
           (or (equal major-mode 'java-mode) (equal major-mode 'java-ts-mode))
         (setq lsp-java-server-install-dir
               (concat (getenv "JDTLS_PATH") "/share/java/"))))
     (defun lsp-java ())
     (defun lsp-java--ls-command ()
       (message (concat (getenv "JDTLS_PATH") "/share/java/"))
       (list (concat (getenv "JDTLS_PATH") "/bin/jdt-language-server")
             "-configuration" (concat (getenv "HOME") "/.jdtls/config_linux")
             "-data" (concat (getenv "HOME") "/.jdtls/java-workspace")))
     :mode ("\\.java\\'" . java-mode)
     :hook ((envrc-mode . lsp-envrc-mode-setup)
            (java-ts-mode . lsp-deferred)))
  (use-package lsp-sonarlint
    :straight (lsp-sonarlint :type git :host nil :repo "https://git.sr.ht/~magic_rb/lsp-sonarlint")
    :config
    (require 'lsp-sonarlint-java-ts)
    (set-variable 'lsp-sonarlint-java-ts-enabled t)
    (set-variable 'lsp-sonarlint-java-program "java17"))