lsp.el 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ;; (require 'lsp-java)
  2. (add-hook 'java-mode-hook #'lsp)
  3. (add-hook 'javascript-mode #'lsp)
  4. (add-hook 'kotlin-mode-hook 'lsp)
  5. (add-hook 'go-mode-hook 'lsp)
  6. (add-hook 'python-mode-hook 'lsp)
  7. (add-hook 'rust-mode-hook 'lsp)
  8. ;; (add-hook 'c-mode-hook 'lsp)
  9. ;; (add-hook 'c++-mode-hook 'lsp)
  10. (setq lsp-ui-sideline-enable nil) ;right menu
  11. (setq lsp-file-watch-threshold nil)
  12. (setq lsp-lua-emmy-jar-path (expand-file-name "EmmyLua-LS-all.jar" user-emacs-directory))
  13. ;; TODO: Spring
  14. ;; (require 'lsp-java-boot)
  15. ;; ;; to enable the lenses
  16. ;; (add-hook 'lsp-mode-hook #'lsp-lens-mode)
  17. ;; (add-hook 'java-mode-hook #'lsp-java-boot-lens-mode)
  18. ;; GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
  19. ;; https://github.com/emacs-lsp/lsp-java/issues/173
  20. (defun seq-first (sequence)
  21. "Return the first element of SEQUENCE."
  22. (seq-elt sequence 0))
  23. ;;;
  24. ;;; JavaScript
  25. ;;;
  26. (add-hook 'js-mode-hook 'lsp)
  27. (when (macrop #'bind-key)
  28. (add-hook 'js-mode-hook
  29. `(lambda ()
  30. (define-key js-mode-map [(meta ?.)] #'lsp-find-definition))))
  31. ;;;
  32. ;;; Python
  33. ;;;
  34. (setq lsp-pyls-plugins-flake8-max-line-length 110)
  35. (setq lsp-pyls-plugins-pycodestyle-max-line-length 110)
  36. ;;;
  37. ;;; Lua
  38. ;;;
  39. (setq lsp-clients-lua-language-server-install-dir
  40. "/nix/store/g4jmyxpsdlwyfddsbchyvfim1n6a7868-sumneko-lua-language-server-3.5.6/share/lua-language-server")
  41. (setq lsp-clients-lua-language-server-bin
  42. "/nix/store/g4jmyxpsdlwyfddsbchyvfim1n6a7868-sumneko-lua-language-server-3.5.6/bin/lua-language-server")
  43. (setq lsp-clients-lua-language-server-main-location
  44. "/nix/store/g4jmyxpsdlwyfddsbchyvfim1n6a7868-sumneko-lua-language-server-3.5.6/share/lua-language-server/main.lua")
  45. (add-hook 'lua-mode-hook 'lsp)
  46. ;;;
  47. ;;; PHP
  48. ;;;
  49. (setq lsp-phpactor-path "/home/oleg/.nix-profile/bin/phpactor")
  50. (add-hook 'php-mode-hook 'lsp)
  51. ;;;
  52. ;;; Nix
  53. ;;;
  54. (with-eval-after-load 'lsp
  55. (load-config-file "lsp-nixd.el"))
  56. (add-hook 'nix-mode-hook 'lsp)