mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 19:46:28 +00:00
Refactor to avoid deprecated function when not needed
This commit is contained in:
parent
80ad56a2b1
commit
d59116e32d
@ -73,19 +73,15 @@ local function get_default_attach(override_capabilities)
|
||||
server_capabilities = vim.tbl_extend("force", server_capabilities, override_capabilities or {})
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
-- Set built in features to use lsp functions (automatic in nvim-0.8)
|
||||
-- HACK: Support for <0.8
|
||||
if vim.fn.has("nvim-0.8") ~= 1 then
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
if server_capabilities.documentSymbolProvider then
|
||||
buf_set_option("tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
end
|
||||
if server_capabilities.documentFormattingProvider then
|
||||
buf_set_option("formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user