]> Sergey Matveev's repositories - vim-lsp.git/blob - autoload/lsp/options.vim
b8fbb95ec720ba196d2565fce13b0033494770c8
[vim-lsp.git] / autoload / lsp / options.vim
1 vim9script
2
3 # LSP plugin options
4 # User can override these by calling the OptionsSet() function.
5 export var lspOptions: dict<any> = {
6   # Enable ale diagnostics support.
7   # If true, diagnostics will be sent to ale, which will be responsible for
8   # showing them.
9   aleSupport: false,
10   # In insert mode, complete the current symbol automatically
11   # Otherwise, use omni-completion
12   autoComplete: true,
13   # In normal mode, highlight the current symbol automatically
14   autoHighlight: false,
15   # Automatically highlight diagnostics messages from LSP server
16   autoHighlightDiags: true,
17   # Automatically populate the location list with new diagnostics
18   autoPopulateDiags: false,
19   # icase | fuzzy | case match for language servers that replies with a full
20   # list of completion items
21   completionMatcher: 'case',
22   # diagnostics signs options
23   diagSignErrorText: 'E>',
24   diagSignHintText: 'H>',
25   diagSignInfoText: 'I>',
26   diagSignWarningText: 'W>',
27   # In insert mode, echo the current symbol signature in the status line
28   # instead of showing it in a popup
29   echoSignature: false,
30   # hide disabled code actions
31   hideDisabledCodeActions: false,
32   # Highlight diagnostics inline
33   highlightDiagInline: false,
34   # Show the symbol documentation in the preview window instead of in a popup
35   hoverInPreview: false,
36   # Don't print message when a configured language server is missing.
37   ignoreMissingServer: false,
38   # Focus on the location list window after LspDiagShow
39   keepFocusInDiags: true,
40   # Focus on the location list window after LspShowReferences
41   keepFocusInReferences: true,
42   # If true, apply the LSP server supplied text edits after a completion.
43   # If a snippet plugin is going to apply the text edits, then set this to
44   # false to avoid applying the text edits twice.
45   completionTextEdit: true,
46   # Alignment of virtual diagnostic text, when showDiagWithVirtualText is true
47   # Allowed values: 'above' | 'below' | 'after' (default is 'above')
48   diagVirtualTextAlign: 'above',
49   # instead of the signature
50   noDiagHoverOnLine: true,
51   # Suppress adding a new line on completion selection with <CR>
52   noNewlineInCompletion: false,
53   # Open outline window on right side
54   outlineOnRight: false,
55   # Outline window size
56   outlineWinSize: 20,
57   # Make diagnostics show in a popup instead of echoing
58   showDiagInPopup: true,
59   # Suppress diagnostic hover from appearing when the mouse is over the line
60   # Show a diagnostic message on a status line
61   showDiagOnStatusLine: false,
62   # Show a diagnostic messages using signs
63   showDiagWithSign: true,
64   # Show a diagnostic messages with virtual text
65   showDiagWithVirtualText: false,
66   # enable inlay hints
67   showInlayHints: false,
68   # In insert mode, show the current symbol signature automatically
69   showSignature: true,
70   # enable snippet completion support
71   snippetSupport: false,
72   # enable SirVer/ultisnips completion support
73   ultisnipsSupport: false,
74   # enable hrsh7th/vim-vsnip completion support
75   vsnipSupport: false,
76   # Use a floating menu to show the code action menu instead of asking for input
77   usePopupInCodeAction: false,
78   # ShowReferences in a quickfix list instead of a location list`
79   useQuickfixForLocations: false,
80   # add to autocomplition list current buffer words
81   useBufferCompletion: false,
82   # Limit the time autocompletion searches for words in current buffer (in milliseconds)
83   bufferCompletionTimeout: 100,
84   # Enable support for custom completion kinds
85   customCompletionKinds: false,
86   # A dictionary with all completion kinds that you want to customize
87   completionKinds: {}
88 }
89
90 export const COMPLETIONMATCHER_CASE = 1
91 export const COMPLETIONMATCHER_ICASE = 2
92 export const COMPLETIONMATCHER_FUZZY = 3
93
94 # set the LSP plugin options from the user provided option values
95 export def OptionsSet(opts: dict<any>)
96   lspOptions->extend(opts)
97   if !has('patch-9.0.0178')
98     lspOptions.showInlayHints = false
99   endif
100   if !has('patch-9.0.1157')
101     lspOptions.showDiagWithVirtualText = false
102   endif
103
104   # For faster comparison, convert the 'completionMatcher' option value from a
105   # string to a number.
106   lspOptions.completionMatcherValue = COMPLETIONMATCHER_CASE
107   if lspOptions.completionMatcher == 'icase'
108     lspOptions.completionMatcherValue = COMPLETIONMATCHER_ICASE
109   elseif lspOptions.completionMatcher == 'fuzzy'
110     lspOptions.completionMatcherValue = COMPLETIONMATCHER_FUZZY
111   endif
112 enddef
113
114 # return a copy of the LSP plugin options
115 export def OptionsGet(): dict<any>
116   return lspOptions->deepcopy()
117 enddef
118
119 # vim: tabstop=8 shiftwidth=2 softtabstop=2