Enable inlay hints for typescript.
This commit is contained in:
parent
724a8ca394
commit
1024f37691
@ -23,6 +23,52 @@
|
|||||||
(run-command-on-buffer "jq" "--monochrome-output" ".")
|
(run-command-on-buffer "jq" "--monochrome-output" ".")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defun configure-typescript-language-server ()
|
||||||
|
"Configures the typescript language server."
|
||||||
|
(when-linux
|
||||||
|
;; Either initializationOptions or workspace/didChangeConfiguration works.
|
||||||
|
(setq eglot-workspace-configuration
|
||||||
|
(list (cons ':typescript '(:inlayHints (:includeInlayParameterNameHints
|
||||||
|
"all"
|
||||||
|
:includeInlayParameterNameHintsWhenArgumentMatchesName
|
||||||
|
t
|
||||||
|
:includeInlayFunctionParameterTypeHints
|
||||||
|
t
|
||||||
|
:includeInlayVariableTypeHints
|
||||||
|
t
|
||||||
|
:includeInlayVariableTypeHintsWhenTypeMatchesName
|
||||||
|
t
|
||||||
|
:includeInlayPRopertyDeclarationTypeHints
|
||||||
|
t
|
||||||
|
:includeInlayFunctionLikeReturnTypeHints
|
||||||
|
t
|
||||||
|
:includeInlayEnumMemberValueHints
|
||||||
|
t)))))
|
||||||
|
(eglot-ensure)
|
||||||
|
;; (defclass my/eglot-typescript (eglot-lsp-server) ()
|
||||||
|
;; :documentation
|
||||||
|
;; "Own eglot server class.")
|
||||||
|
|
||||||
|
;; (add-to-list 'eglot-server-programs
|
||||||
|
;; '((js-mode js-ts-mode tsx-ts-mode typescript-ts-mode typescript-mode) . (my/eglot-typescript "typescript-language-server" "--stdio" :initializationOptions (:preferences (:includeInlayParameterNameHints
|
||||||
|
;; "all"
|
||||||
|
;; :includeInlayParameterNameHintsWhenArgumentMatchesName
|
||||||
|
;; t
|
||||||
|
;; :includeInlayFunctionParameterTypeHints
|
||||||
|
;; t
|
||||||
|
;; :includeInlayVariableTypeHints
|
||||||
|
;; t
|
||||||
|
;; :includeInlayVariableTypeHintsWhenTypeMatchesName
|
||||||
|
;; t
|
||||||
|
;; :includeInlayPRopertyDeclarationTypeHints
|
||||||
|
;; t
|
||||||
|
;; :includeInlayFunctionLikeReturnTypeHints
|
||||||
|
;; t
|
||||||
|
;; :includeInlayEnumMemberValueHints
|
||||||
|
;; t)))))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(use-package tsx-ts-mode
|
(use-package tsx-ts-mode
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:pin manual
|
:pin manual
|
||||||
@ -33,7 +79,7 @@
|
|||||||
:hook (
|
:hook (
|
||||||
(tsx-ts-mode . (lambda ()
|
(tsx-ts-mode . (lambda ()
|
||||||
(when-linux
|
(when-linux
|
||||||
(eglot-ensure)
|
(configure-typescript-language-server)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
@ -52,9 +98,7 @@
|
|||||||
:commands (typescript-ts-mode)
|
:commands (typescript-ts-mode)
|
||||||
:hook (
|
:hook (
|
||||||
(typescript-ts-mode . (lambda ()
|
(typescript-ts-mode . (lambda ()
|
||||||
(when-linux
|
(configure-typescript-language-server)
|
||||||
(eglot-ensure)
|
|
||||||
)
|
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
:init
|
:init
|
||||||
|
Loading…
x
Reference in New Issue
Block a user