diff --git a/emacs/init.org b/emacs/init.org index 7c2284a..d202292 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -953,10 +953,21 @@ 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") - (web-mode-set-content-type "jsx"))))) + (lambda () + (when (equal web-mode-content-type "javascript") + (web-mode-set-content-type "jsx")) + (when (or (equal web-mode-content-type "javascript") + (equal web-mode-content-type "jsx")) + (lsp))))) #+END_SRC Use nvm to manage node versions: