From d59116e32d26d974e66372d7f3ebc6bd0b727bba Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Mon, 17 Jun 2024 10:06:27 -0700 Subject: [PATCH] Refactor to avoid deprecated function when not needed --- neovim/lua/plugins/lsp.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/neovim/lua/plugins/lsp.lua b/neovim/lua/plugins/lsp.lua index 7457853..19a2d13 100644 --- a/neovim/lua/plugins/lsp.lua +++ b/neovim/lua/plugins/lsp.lua @@ -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