diff --git a/emacs/init.org b/emacs/init.org index d202292..7c7d60d 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -953,14 +953,7 @@ Some formatting stuff: ("\\.js\\'" . web-mode) ("\\.jsx\\'" . web-mode)) :config - (defun lsp-typescript-javascript-tsx-jsx-activate-p (filename major-mode) - "Checks if the javascript-typescript language server should be enabled - based on FILE-NAME and MAJOR-MODE" - (or (member major-mode '(typescript-mode typescript-tsx-mode js-mode js2-mode rjsx-mode)) - (and (eq major-mode 'web-mode) - (or (string-suffix-p ".tsx" filename t) - (string-suffix-p ".jsx" filename t) - (string-suffix-p ".js" filename t))))) + (add-hook 'web-mode-hook (lambda () (when (equal web-mode-content-type "javascript") @@ -986,9 +979,9 @@ Emacs support for the Language Server Protocol #+BEGIN_SRC emacs-lisp (use-package lsp-mode - :general - ('normal lsp-mode-map "SPC cd" #'lsp-find-definition) - ('normal lsp-mode-map "SPC cr" #'lsp-find-references)) + :config + (general-def 'normal lsp-mode-map "SPC cd" #'lsp-find-definition) + (general-def 'normal lsp-mode-map "SPC cr" #'lsp-find-references)) (use-package company-lsp :after (company) @@ -1004,6 +997,16 @@ Emacs support for the Language Server Protocol (use-package dap-mode :after (lsp-mode)) + + (with-eval-after-load 'lsp-clients + (defun lsp-typescript-javascript-tsx-jsx-activate-p (filename major-mode) + "Checks if the javascript-typescript language server should be enabled + based on FILE-NAME and MAJOR-MODE" + (or (member major-mode '(typescript-mode typescript-tsx-mode js-mode js2-mode rjsx-mode)) + (and (eq major-mode 'web-mode) + (or (string-suffix-p ".tsx" filename t) + (string-suffix-p ".jsx" filename t) + (string-suffix-p ".js" filename t)))))) #+END_SRC * Java @@ -1041,11 +1044,11 @@ Configure Java project sources: Elpy is a python IDE package: #+BEGIN_SRC emacs-lisp - (use-package elpy + (use-package pyvenv :config -; (elpy-enable) - (pyvenv-mode) - (leader-def-key "sp" #'elpy-shell-switch-to-shell)) + (pyvenv-mode)) + + (leader-def-key "sp" #'python-shell-switch-to-shell) (defun eshell/workon (name) (pyvenv-workon name))