From 9ef7297ef142354ace8b1f3f277d0eee3cfdc6d4 Mon Sep 17 00:00:00 2001 From: Michal Liszcz Date: Thu, 9 Mar 2023 15:12:56 +0100 Subject: feat(lsp): overwrite omnifunc/tagfunc set by ftplugin #22267 Problem: Some built-in ftplugins set omnifunc/tagfunc/formatexpr which causes lsp.lua:set_defaults() to skip setup of defaults for those filetypes. For example the C++ ftplugin has: omnifunc=ccomplete#Complete Last set from /usr/share/nvim/runtime/ftplugin/c.vim line 30 so the changes done in #95c65a6b221fe6e1cf91e8322e7d7571dc511a71 will always be skipped for C++ files. Solution: Overwrite omnifunc/tagfunc/formatexpr options that were set by stock ftplugin. Fixes #21001 --- runtime/doc/lsp.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index b73e2958ef..b21ef9d7d3 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -51,8 +51,11 @@ Starting a LSP client will automatically report diagnostics via |vim.diagnostic|. Read |vim.diagnostic.config()| to learn how to customize the display. -It also sets some buffer options if the options are otherwise empty and if the -language server supports the functionality. +It also sets some buffer options if the language server supports the +functionality and if the options are otherwise empty or have the default +values set by Nvim runtime files (e.g. a ftplugin). In the latter case, +the default values are not restored when the LSP client is detached from +the buffer. - 'omnifunc' is set to |vim.lsp.omnifunc()|. This allows to trigger completion using |i_CTRL-X_CTRL-O| -- cgit