Last active
October 17, 2022 03:39
-
-
Save epetousis/f9e8129b4c13c033cd12546e93b41bf1 to your computer and use it in GitHub Desktop.
Minimum code needed to get Volar working with eglot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package eglot | |
:config (add-to-list 'eglot-server-programs | |
'(web-mode . (eglot-volar "vue-language-server" "--stdio")))) | |
(defclass eglot-volar (eglot-lsp-server) () | |
:documentation "A custom class for Volar's langserver.") | |
;; Volar requires a path to a TypeScript SDK. It normally uses VSCode's preinstalled SDK. | |
;; tsdk is the correct variable as of https://github.com/johnsoncodehk/volar/pull/1916 being merged, but it may change at any time. | |
(cl-defmethod eglot-initialization-options ((server eglot-volar)) | |
"Passes through required Volar initialization options" | |
(let* ((tsdk (concat (projectile-project-root) "node_modules/typescript/lib"))) | |
(list :typescript (list :tsdk (file-name-as-directory tsdk))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment