[Emacs] Better LSP setup, restore lua-mode

This commit is contained in:
Lucien Cartier-Tilet 2021-12-17 16:45:57 +01:00
parent ac04636e54
commit 0e86789285
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -1259,6 +1259,7 @@ Due to this, I absolutely need a mode for editing Dockerfiles.
(use-package dockerfile-mode (use-package dockerfile-mode
:defer t :defer t
:straight (:build t) :straight (:build t)
:hook (dockerfile-mode . lsp-deferred)
:init :init
(put 'docker-image-name 'safe-local-variable #'stringp) (put 'docker-image-name 'safe-local-variable #'stringp)
:mode "Dockerfile\\'") :mode "Dockerfile\\'")
@ -4991,15 +4992,9 @@ awesome!
:straight (:build t) :straight (:build t)
:init :init
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:hook ((rust-mode . lsp-deferred) :hook ((c-mode . lsp-deferred)
(c-mode . lsp-deferred)
(c++-mode . lsp-deferred) (c++-mode . lsp-deferred)
(css-mode . lsp-deferred)
(dart-mode . lsp-deferred)
(html-mode . lsp-deferred) (html-mode . lsp-deferred)
(lua-mode . lsp-deferred)
(rust-mode . lsp-deferred)
(dockerfile-mode . lsp-deferred)
(lsp-mode . lsp-enable-which-key-integration) (lsp-mode . lsp-enable-which-key-integration)
(lsp-mode . lsp-ui-mode)) (lsp-mode . lsp-ui-mode))
:commands (lsp lsp-deferred) :commands (lsp lsp-deferred)
@ -5634,6 +5629,7 @@ configuration for StumpWM]].
(use-package dart-mode (use-package dart-mode
:straight (:build t) :straight (:build t)
:defer t :defer t
:hook (dart-mode . lsp-deferred)
:mode "\\.dart\\'") :mode "\\.dart\\'")
#+end_src #+end_src
@ -5706,38 +5702,39 @@ comma.
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Lua-p2odc7p0t4j0 :CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Lua-p2odc7p0t4j0
:END: :END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (use-package lua-mode (use-package lua-mode
;; :defer t :defer t
;; :straight (:build t) :straight (:build t)
;; :mode "\\.lua$" :mode "\\.lua'$"
;; :interpreter "lua" :interpreter "lua"
;; :init :hook (lua-mode . lsp-deferred)
;; (setq lua-indent-level 2 :init
;; lua-indent-string-contents t) (setq lua-indent-level 2
;; :general lua-indent-string-contents t)
;; (phundrak/major-leader-key :general
;; :keymaps lua-mode-map (phundrak/major-leader-key
;; "'" #'lua-show-process-buffer :keymaps 'lua-mode-map
;; "h" '(:ignore :wk "help") "'" #'lua-show-process-buffer
;; "hd" #'lua-search-documentation "h" '(:ignore t :wk "help")
;; "s" '(:ignore :wk "REPL") "hd" #'lua-search-documentation
;; "sb" #'lua-send-buffer "s" '(:ignore t :wk "REPL")
;; "sf" #'lua-send-defun "sb" #'lua-send-buffer
;; "sl" #'lua-send-current-line "sf" #'lua-send-defun
;; "sr" #'lua-send-region)) "sl" #'lua-send-current-line
"sr" #'lua-send-region))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (use-package lsp-lua-emmy (use-package lsp-lua-emmy
;; :defer t :defer t
;; :after (lua-mode lsp-mode) :after (lua-mode lsp-mode)
;; :straight (lsp-lua-emmy :build t :straight (lsp-lua-emmy :build t
;; :type git :type git
;; :host github :host github
;; :repo "EmmyLua/EmmyLua-LanguageServer") :repo "EmmyLua/EmmyLua-LanguageServer")
;; :hook (lua-mode . lsp-deferred) :hook (lua-mode . lsp-deferred)
;; :config :config
;; (setq lsp-lua-emmy-jar-path (expand-file-name "EmmyLua-LS-all.jar" user-emacs-directory))) (setq lsp-lua-emmy-jar-path (expand-file-name "EmmyLua-LS-all.jar" user-emacs-directory)))
#+end_src #+end_src
**** Python **** Python
@ -6000,10 +5997,13 @@ development. First, lets install the most important package,
:defer t :defer t
:straight (:build t) :straight (:build t)
:mode ("\\.rs\\'" . rustic-mode) :mode ("\\.rs\\'" . rustic-mode)
:hook (rustic-mode-local-vars . rustic-setup-lsp)
:hook (rustic-mode . lsp-deferred)
:init :init
(after! org-src (after! org-src
(defalias 'org-babel-execute:rust #'org-babel-execute:rustic) (defalias 'org-babel-execute:rust #'org-babel-execute:rustic)
(add-to-list 'org-src-lang-modes '("rust" . rustic))) (add-to-list 'org-src-lang-modes '("rust" . rustic)))
(setq rustic-lsp-client 'lsp-mode)
:general :general
(general-define-key (general-define-key
:keymaps 'rustic-mode-map :keymaps 'rustic-mode-map
@ -6038,9 +6038,7 @@ development. First, lets install the most important package,
rustic-format-trigger nil) rustic-format-trigger nil)
(remove-hook 'rustic-mode-hook #'flycheck-mode) (remove-hook 'rustic-mode-hook #'flycheck-mode)
(remove-hook 'rustic-mode-hook #'flymake-mode-off) (remove-hook 'rustic-mode-hook #'flymake-mode-off)
(remove-hook 'rustic-mode-hook #'rustic-setup-lsp) (remove-hook 'rustic-mode-hook #'rustic-setup-lsp))
(add-hook 'rustic-mode-local-vars-hook #'rustic-setup-lsp)
(setq rustic-lsp-client 'lsp-mode))
#+end_src #+end_src
**** Web programming **** Web programming
@ -6250,20 +6248,25 @@ And finally, here is a formatter for Javascript.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package prettier-js (use-package prettier-js
:defer t :defer t
:straight (:build t)) :straight (:build t)
:hook (rjsx-mode . prettier-js-mode))
#+end_src #+end_src
***** Typescript ***** Typescript
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Web-programming-Typescript-o0e8nh30z9j0 :CUSTOM_ID: Packages-Configuration-Programming-languages-General-Programming-Languages-Web-programming-Typescript-o0e8nh30z9j0
:END: :END:
Typescript is a safer alternative to Javascript. Lets install its major mode then.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package typescript-mode (use-package typescript-mode
:defer t :defer t
:straight (:build t) :straight (:build t)
:hook (typescript-mode . rainbow-delimiters-mode) :hook (typescript-mode . rainbow-delimiters-mode)
:hook (typescript-mode . lsp-deferred)
:hook (typescript-tsx-mode . rainbow-delimiters-mode) :hook (typescript-tsx-mode . rainbow-delimiters-mode)
:hook (typescript-tsx-mode . lsp-deferred)
:commands typescript-tsx-mode :commands typescript-tsx-mode
:after flycheck
:init :init
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode)) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
:general :general