mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(lsp): set formatexpr by default (#19677)
Follow up to https://github.com/neovim/neovim/pull/19003
This commit is contained in:
committed by
GitHub
parent
d31ee6664d
commit
68c674af0f
@@ -968,12 +968,20 @@ function lsp.start_client(config)
|
||||
|
||||
---@private
|
||||
local function set_defaults(client, bufnr)
|
||||
if client.server_capabilities.definitionProvider and vim.bo[bufnr].tagfunc == '' then
|
||||
local capabilities = client.server_capabilities
|
||||
if capabilities.definitionProvider and vim.bo[bufnr].tagfunc == '' then
|
||||
vim.bo[bufnr].tagfunc = 'v:lua.vim.lsp.tagfunc'
|
||||
end
|
||||
if client.server_capabilities.completionProvider and vim.bo[bufnr].omnifunc == '' then
|
||||
if capabilities.completionProvider and vim.bo[bufnr].omnifunc == '' then
|
||||
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
end
|
||||
if
|
||||
capabilities.documentRangeFormattingProvider
|
||||
and vim.bo[bufnr].formatprg == ''
|
||||
and vim.bo[bufnr].formatexpr == ''
|
||||
then
|
||||
vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr()'
|
||||
end
|
||||
end
|
||||
|
||||
---@private
|
||||
@@ -986,6 +994,9 @@ function lsp.start_client(config)
|
||||
if vim.bo[bufnr].omnifunc == 'v:lua.vim.lsp.omnifunc' then
|
||||
vim.bo[bufnr].omnifunc = nil
|
||||
end
|
||||
if vim.bo[bufnr].formatexpr == 'v:lua.vim.lsp.formatexpr()' then
|
||||
vim.bo[bufnr].formatexpr = nil
|
||||
end
|
||||
end
|
||||
|
||||
---@private
|
||||
|
||||
Reference in New Issue
Block a user