]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add example of "customNotificationHandlers"
authorAndreas Louv <andreas@louv.dk>
Wed, 12 Apr 2023 12:09:12 +0000 (14:09 +0200)
committerAndreas Louv <andreas@louv.dk>
Thu, 13 Apr 2023 05:38:15 +0000 (07:38 +0200)
doc/lsp.txt

index 1a7313e9ee0be0469a3ecf2b791c814360234e39..370a420c65da0b1a743f1aa32682af6c774c63d6 100644 (file)
@@ -284,7 +284,21 @@ Aditionally the following configurations can be made:
                        typescript-language-server) will send additional
                        notifications which you might want to silence or handle.
                        The provided notification handlers will be called with a
-                       reference to the "lspserver" and the "reply".
+                       reference to the "lspserver" and the "reply". >
+
+               vim9script
+               g:LspAddServer([{
+                       filetype: ['javascript', 'typescript'],
+                       path: '/usr/local/bin/typescript-language-server',
+                       args: ['--stdio'],
+                       customNotificationHandlers: {
+                               '$/typescriptVersion': (lspserver, reply) => {
+                                       echom printf("TypeScript Version = %s",
+                                               reply.params.version)
+                               }
+                       }
+               }])
+<
                                                *lsp-cfg-omnicompl*
        omnicompl       (Optional) a boolean value that enables (true)
                        or disables (false) omni-completion for this file