java.el 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. (add-hook 'java-mode-hook 'highlight-indent-guides-mode)
  2. (defconst wi-java--prettify-symbols-alist
  3. `(("@Bean" . ,(string-to-symbols "@instance-of-a-class")) ;fancy word
  4. ("@Autowired" . ,(string-to-symbols "@field-injection"))
  5. ("$$" . ,(string-to-symbols "enhanced")) ;you could this in debug
  6. ))
  7. (when (functionp #'add-hooks)
  8. (add-hooks
  9. '(((java-mode-hook)
  10. . (lambda ()
  11. (set (make-local-variable 'prettify-symbols-alist)
  12. wi-java--prettify-symbols-alist))))))
  13. (add-hook 'java-mode-hook 'display-fill-column-indicator-mode)
  14. ;; Copied and modified from:
  15. ;; https://github.com/emacs-lsp/lsp-java/issues/26
  16. ;;
  17. ;; Java Configuration
  18. (let ((directory
  19. ;; TODO: Do not hardcode, e.g. use `lsp-java-server-install-dir'.
  20. (concat (file-name-directory "/home/oleg/.emacs.d/.cache/lsp/eclipse.jdt.ls/")
  21. "lombok")))
  22. (setq lombok-library-path (concat (file-name-directory directory)
  23. "lombok.jar"))
  24. (unless (file-exists-p lombok-library-path)
  25. (mkdir (file-name-directory lombok-library-path) t)
  26. (url-copy-file "https://projectlombok.org/downloads/lombok.jar"
  27. lombok-library-path))
  28. ;; TODO: do not hardcode, e.g. use `lsp-java-vmargs'.
  29. (setq lsp-java-vmargs
  30. (append (list (concat "-javaagent:"
  31. (expand-file-name lombok-library-path)))
  32. '("-noverify"
  33. "-Xmx1G"
  34. "-XX:+UseG1GC"
  35. "-XX:+UseStringDeduplication"))))