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