From f20f31637d1bb569fb5e0aaa4b52d32d60760cb2 Mon Sep 17 00:00:00 2001 From: Jessie Hildebrandt Date: Sat, 29 Aug 2020 17:28:17 -0400 Subject: [PATCH] Add further integrations and fixes for lsp-mode --- init.el | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index 87234f2..b89c9d0 100644 --- a/init.el +++ b/init.el @@ -412,15 +412,18 @@ ("\\.lua\\'" . lua-mode)) ;; Load Web Mode -;; (Associated files: .php, .inc, .html) +;; (Associated files: .php, .html) +;; (In js-mode: .ts) +;; (In js-jsx-mode: .jsx, .tsx) (use-package web-mode :custom (web-mode-markup-indent-offset 2) (web-mode-enable-auto-quoting nil) :mode (("\\.php\\'" . web-mode) - ("\\.inc\\'" . web-mode) - ("\\.html\\'" . web-mode))) + ("\\.html\\'" . web-mode) + ("\\.ts\\'" . js-mode) + ("\\.[jt]sx\\'" . js-jsx-mode))) ;; Load JSON Mode ;; (Associated files: .json) @@ -475,13 +478,38 @@ :hook (web-mode . lsp-deferred) (js-mode . lsp-deferred) + (css-mode . lsp-deferred) (json-mode . lsp-deferred) (gdscript-mode . lsp-deferred) (rust-mode . lsp-deferred) + :custom + (lsp-signature-auto-activate nil) + (lsp-signature-render-documentation nil) + (lsp-eldoc-hook nil) :commands (lsp lsp-deferred)) +;; Load LSP UI +(use-package lsp-ui + :custom + (lsp-ui-imenu-enable nil) + (lsp-ui-peek-enable t) + (lsp-ui-peek-always-show t) + (lsp-ui-doc-enable nil) + (lsp-ui-doc-max-width 50) + (lsp-ui-doc-max-height 10) + (lsp-ui-doc-position 'at-point) + (lsp-ui-doc-header t) + (lsp-ui-doc-include-signature t) + :config + (setq lsp-ui-doc-border (face-background 'lsp-ui-doc-background)) + :bind + (:map lsp-ui-mode-map + ("M-," . (lambda () (interactive) (lsp-ui-doc-mode t) (lsp-ui-doc-glance) (lsp-ui-doc-mode nil))) + ("M-." . lsp-ui-peek-find-definitions) + ("M-?" . lsp-ui-peek-find-references))) + ;;==================== ;; Package-Lint (Elisp Package Linter) ;;==================== @@ -503,6 +531,8 @@ :hook (prog-mode . flycheck-mode) (c++-mode-hook . (lambda () (setq flycheck-clang-standard "c++17"))) + :config + (advice-add 'flycheck-eslint-config-exists-p :override (lambda() t)) :custom (flycheck-python-flake8-executable "flake8") (flycheck-python-pylint-executable "pylint")