event: 'TextChangedI',
group: 'LSPBufferAutocmds',
cmd: 'LspComplete()'})
- else
+ endif
+
+ if LspOmniComplEnabled(ftype)
setbufvar(bnr, '&omnifunc', 'g:LspOmniFunc')
endif
autocmd_add(acmds)
enddef
+# Buffer "bnr" is loaded in a window. If omni-completion is enabled for this
+# buffer, then set the 'omnifunc' option.
+export def BufferLoadedInWin(bnr: number)
+ if !opt.lspOptions.autoComplete
+ && LspOmniComplEnabled(bnr->getbufvar('&filetype'))
+ setbufvar(bnr, '&omnifunc', 'g:LspOmniFunc')
+ endif
+enddef
+
# vim: tabstop=8 shiftwidth=2 softtabstop=2
if opt.lspOptions.autoHighlightDiags
diag.DiagsRefresh(bnr)
endif
+ completion.BufferLoadedInWin(bnr)
enddef
# Stop all the LSP servers
continue
endif
# Enable omni-completion by default
- server.omnicompl = server->get('omnicompl', true)
+ var omnicompl_def: bool = false
+ if opt.lspOptions.omniComplete == true
+ || (opt.lspOptions.omniComplete == null
+ && !opt.lspOptions.autoComplete)
+ omnicompl_def = true
+ endif
+ server.omnicompl = server->get('omnicompl', omnicompl_def)
if !server.path->executable()
if !opt.lspOptions.ignoreMissingServer
completion selection with <CR>.
By default this is set to false.
+ *lsp-opt-omniComplete*
+omniComplete |Boolean| option. Enables or disables omni-completion.
+ By default this is set to v:false. If "autoComplete"
+ is set to v:false, then omni-completion is enabled by
+ default. By setting "omniComplete" option to v:false,
+ omni-completion can also be disabled.
+
*lsp-opt-outlineOnRight*
outlineOnRight |Boolean| option. Open the outline window on the
right side, by default this is false.
returned items. You can modify the 'completionMatcher' option to use either
case insensitive or fuzzy comparison.
+To enable auto completion for all the buffers, set the "autoComplete" option
+to v:true (default). To disable auto completion for all the buffers, set the
+"autoComplete" option to v:false. If auto completion is disabled for all the
+buffers, then omni-completion is enabled. To disable omni-completion for all
+the buffers, set the "omniComplete" option to v:false (default). To enable
+omni-completion for all the buffers, set the "omniComplete" option to v:true.
+You can also enable or disable omni-completion for a specific language server,
+by setting the "omnicompl" item when registering the language server.
+
In addition to the automatic completion and omni completion, it is possible to
use external completion engines. LSP client can be used as a completion source
by repurposing `g:LspOmniFunc` function. The adapter which interfaces with
`g:LspOmniFunc` waits for up to 2 seconds. This wait blocks the caller from
doing other work, which may be a concern for asynchronous completion engines.
To avoid blocking wait call `g:LspOmniCompletePending` function which returns
-`true` immediately if LSP server is not ready. `g:LspOmniFunc` can be
+`true` immediately if the language server is not ready. `g:LspOmniFunc` can be
called (the second time) only after this function returns `false`.
==============================================================================