KDE & Emacs

This commit is contained in:
venomade committed 2026-01-18 16:07:54 +00:00
1 parent edcf5dd381
commit 8d688d1107
50 files changed
+2122 -1267

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
;; Emacs Configuration for Java
; JDT URI fix for JDTLS from https://www.reddit.com/r/emacs/comments/1ibkh2h/comment/m9slw00/
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
`((java-mode java-ts-mode) .
("jdtls"
:initializationOptions
(:extendedClientCapabilities (:classFileContentsSupport t))))))
(defun jdt-file-name-handler (operation &rest args)
"Support Eclipse jdtls `jdt://' uri scheme."
(let* ((uri (car args))
(cache-dir "/tmp/.eglot")
(source-file
(expand-file-name
(file-name-concat
cache-dir
(save-match-data
(when (string-match "jdt://contents/\\(.*?\\)/\\(.*\\)\.class\\?" uri)
(format "%s.java" (replace-regexp-in-string "/" "." (match-string 2 uri) t t))))))))
(unless (file-readable-p source-file)
(let ((content (jsonrpc-request (eglot-current-server) :java/classFileContents (list :uri uri)))
(metadata-file (format "%s.%s.metadata"
(file-name-directory source-file)
(file-name-base source-file))))
(unless (file-directory-p cache-dir) (make-directory cache-dir t))
(with-temp-file source-file (insert content))
(with-temp-file metadata-file (insert uri))))
source-file))
(add-to-list 'file-name-handler-alist '("\\`jdt://" . jdt-file-name-handler))
(add-hook 'java-mode-hook #'eglot-ensure t)
(load-file
(expand-file-name
"pkg/consult-jdt.el"
user-emacs-directory))