From: Guillaume Démurgé Date: Thu, 18 May 2023 13:09:18 +0000 (+0200) Subject: Add a global example of the features configuration into README X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5bdee57895a775513be35555acb4148cd9cfde75;p=vim-lsp.git Add a global example of the features configuration into README --- diff --git a/README.md b/README.md index 28527cb..daf721a 100644 --- a/README.md +++ b/README.md @@ -103,19 +103,57 @@ features|A dictionary of booleans that can be specified to toggle what things a The LspAddServer() function accepts a list of LSP servers with the above information. +Some of the LSP plugin features can be enabled or disabled by using the LspOptionsSet() function, detailed in `:help lsp-options`. +Here is an example of configuration with default values: +```viml +call LspOptionsSet(#{ + \ autoComplete: v:true, + \ autoHighlight: v:false, + \ autoHighlightDiags: v:true, + \ autoPopulateDiags: v:false, + \ completionMatcher: 'case', + \ completionTextEdit: v:true, + \ completionKinds: {}, + \ customCompletionKinds: v:false, + \ diagSignErrorText: 'E>', + \ diagSignInfoText: 'I>', + \ diagSignHintText: 'H>', + \ diagSignWarningText: 'W>', + \ diagVirtualTextAlign: 'above', + \ echoSignature: v:false, + \ hideDisabledCodeActions: v:false, + \ highlightDiagInline: v:false, + \ hoverInPreview: v:false, + \ ignoreMissingServer: v:false, + \ keepFocusInReferences: v:false, + \ noDiagHoverOnLine: v:true, + \ noNewlineInCompletion: v:false, + \ outlineOnRight: v:false, + \ outlineWinSize: 20, + \ useQuickfixForLocations: v:false, + \ showDiagInPopup: v:true, + \ showDiagOnStatusLine: v:false, + \ showDiagWithVirtualText: v:false, + \ showInlayHints: v:false, + \ showSignature: v:true, + \ snippetSupport: v:false, + \ ultisnipsSupport: v:false, + \ usePopupInCodeAction: v:false, + \ useBufferCompletion: v:false, + \ }) +``` + If you used [vim-plug](https://github.com/junegunn/vim-plug) to install the LSP plugin, then you need to use the VimEnter autocmd to initialize the LSP server and to set the LSP server options. For example: ```viml -let lspServers = [ - \ #{ - \ name: 'clang', - \ filetype: ['c', 'cpp'], - \ path: '/usr/local/bin/clangd', - \ args: ['--background-index'] - \ } - \ ] +let lspServers = [#{ + \ name: 'clang', + \ filetype: ['c', 'cpp'], + \ path: '/usr/local/bin/clangd', + \ args: ['--background-index'] + \ }] autocmd VimEnter * call LspAddServer(lspServers) -let lspOpts = {'autoHighlightDiags': v:true} +let lspOpts = #{autoHighlightDiags: v:true} autocmd VimEnter * call LspOptionsSet(lspOpts) ```