]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Modify LspOptionsGet() to return a copy of the plugin options. Update comments and doc
authorYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 15 Nov 2022 13:54:51 +0000 (05:54 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Tue, 15 Nov 2022 13:54:51 +0000 (05:54 -0800)
autoload/lsp/options.vim
doc/lsp.txt
plugin/lsp.vim

index f1605f7252629d96656e1ec9f2e3071df4195f99..e24bda26479afc34d77716a6ffb164ae90467b7d 100644 (file)
@@ -42,16 +42,14 @@ export var lspOptions: dict<any> = {
   snippetSupport: false
 }
 
-# set LSP options from user provided options
+# set the LSP plugin options from the user provided option values
 export def OptionsSet(opts: dict<any>)
-  for key in opts->keys()
-    lspOptions[key] = opts[key]
-  endfor
+  lspOptions->extend(opts)
 enddef
 
-# get LSP options
+# return a copy of the LSP plugin options
 export def OptionsGet(): dict<any>
-  return lspOptions
+  return lspOptions->deepcopy()
 enddef
 
 # vim: tabstop=8 shiftwidth=2 softtabstop=2
index b7d6e86526f0ea7ac81c06d1f7dabc96947f0112..724464e3358bc55a5cf34f28a3a95444d76b4466 100644 (file)
@@ -278,17 +278,15 @@ usePopupInCodeAction    When using the |:LspCodeAction| command to display the
                        By default this is set to false.
 
 For example, to disable the automatic placement of signs for the LSP
-diagnostic messages, you can add the following line to your .vimrc file:
->
+diagnostic messages, you can add the following line to your .vimrc file: >
+
        call LspOptionsSet({'autoHighlightDiags': v:false})
 <
+The LspOptionsGet() function returns a |Dict| of all the LSP plugin options,
+To get a particular option value you can use the following: >
 
-And to get or check one option value via its key you can query like following:
->
        echo LspOptionsGet()['autoHighlightDiags']
 <
-Or if no specific key but just LspOptionsGet() then to get all options.
-
 ==============================================================================
 5. Commands                                            *lsp-commands*
 
index 163b5291dfe3f43992fc33b75a8b335bfdb195ed..342e45959e7e779d4faabfc0a8c751ec0ad2c588 100644 (file)
@@ -10,18 +10,22 @@ vim9script
 import autoload '../autoload/lsp/options.vim'
 import autoload '../autoload/lsp/lsp.vim'
 
+# Set LSP plugin options from 'opts'.
 def g:LspOptionsSet(opts: dict<any>)
   options.OptionsSet(opts)
 enddef
 
+# Return a copy of all the LSP plugin options
 def g:LspOptionsGet(): dict<any>
   return options.OptionsGet()
 enddef
 
+# Add one or more LSP servers in 'serverList'
 def g:LspAddServer(serverList: list<dict<any>>)
   lsp.AddServer(serverList)
 enddef
 
+# Register 'Handler' callback function for LSP command 'cmd'.
 def g:LspRegisterCmdHandler(cmd: string, Handler: func)
   lsp.RegisterCmdHandler(cmd, Handler)
 enddef