I can't enable typescript in Vue files (Vue 3, vue language tools) #1395
-
Hi, I can't enable Typescript in Vue files. I get emmet completions, but I get no LSP features inside the What am I doing wrong? Any clues? My config: (defun eglot-volar-find-typescript ()
"Get the global npm typescript location."
(string-trim-right
(shell-command-to-string
"npm list --global --parseable typescript | head -n1")))
(defun eglot-volar-init-options ()
"Get the vue-language-server initOptions."
(let ((tsdk-path (expand-file-name "lib" (eglot-volar-find-typescript))))
`(:typescript (:tsdk ,tsdk-path))))
(use-package eglot
:defer t
:config
;; (setq read-process-output-max (* 1024 1024))
;; For tree-sitter mode
(put 'vue-ts-mode 'eglot-language-id "vue")
(add-to-list 'eglot-server-programs
`(vue-ts-mode . ("vue-language-server" "--stdio" :initializationOptions ,(eglot-volar-init-options))))
:init
(setq
eglot-send-changes-idle-time 0.7
eglot-connect-timeout 120
eglot-autoshutdown t)
:hook
(vue-ts-mode . eglot-ensure)) Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok, I finally found it out!!!! I needed to add (defun eglot-volar-init-options ()
"Get the vue-language-server initOptions."
(let ((tsdk-path (expand-file-name "lib" (eglot-volar-find-typescript))))
`(:typescript (:tsdk ,tsdk-path)
:vue (:hybridMode :json-false)))) Just in case anyone needs it. |
Beta Was this translation helpful? Give feedback.
Ok, I finally found it out!!!! I needed to add
:vue (:hybridMode :json-false)
to disable hybridMode, forvue-language-server
version >2.0.Just in case anyone needs it.