mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
refactor(options): deprecate nvim[_buf|_win]_[gs]et_option
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
This commit is contained in:
committed by
Famiu Haque
parent
e3e6fadfd8
commit
1fe1bb084d
@@ -33,7 +33,9 @@ local test_rpc_server = lsp_helpers.test_rpc_server
|
||||
|
||||
local function get_buf_option(name, bufnr)
|
||||
bufnr = bufnr or "BUFFER"
|
||||
return exec_lua(string.format("return vim.api.nvim_buf_get_option(%s, '%s')", bufnr, name))
|
||||
return exec_lua(
|
||||
string.format("return vim.api.nvim_get_option_value('%s', { buf = %s })", name, bufnr)
|
||||
)
|
||||
end
|
||||
|
||||
-- TODO(justinmk): hangs on Windows https://github.com/neovim/neovim/pull/11837
|
||||
@@ -356,8 +358,8 @@ describe('LSP', function()
|
||||
vim.api.nvim_command('filetype plugin on')
|
||||
BUFFER_1 = vim.api.nvim_create_buf(false, true)
|
||||
BUFFER_2 = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_option(BUFFER_1, 'filetype', 'man')
|
||||
vim.api.nvim_buf_set_option(BUFFER_2, 'filetype', 'xml')
|
||||
vim.api.nvim_set_option_value('filetype', 'man', { buf = BUFFER_1 })
|
||||
vim.api.nvim_set_option_value('filetype', 'xml', { buf = BUFFER_2 })
|
||||
]]
|
||||
|
||||
-- Sanity check to ensure that some values are set after setting filetype.
|
||||
@@ -394,9 +396,9 @@ describe('LSP', function()
|
||||
client = _client
|
||||
exec_lua [[
|
||||
BUFFER = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_buf_set_option(BUFFER, 'tagfunc', 'tfu')
|
||||
vim.api.nvim_buf_set_option(BUFFER, 'omnifunc', 'ofu')
|
||||
vim.api.nvim_buf_set_option(BUFFER, 'formatexpr', 'fex')
|
||||
vim.api.nvim_set_option_value('tagfunc', 'tfu', { buf = BUFFER })
|
||||
vim.api.nvim_set_option_value('omnifunc', 'ofu', { buf = BUFFER })
|
||||
vim.api.nvim_set_option_value('formatexpr', 'fex', { buf = BUFFER })
|
||||
lsp.buf_attach_client(BUFFER, TEST_RPC_CLIENT_ID)
|
||||
]]
|
||||
end;
|
||||
@@ -1166,7 +1168,7 @@ describe('LSP', function()
|
||||
"testing";
|
||||
"123";
|
||||
})
|
||||
vim.api.nvim_buf_set_option(BUFFER, 'eol', false)
|
||||
vim.bo[BUFFER].eol = false
|
||||
]]
|
||||
end;
|
||||
on_init = function(_client)
|
||||
@@ -2929,8 +2931,8 @@ describe('LSP', function()
|
||||
describe('lsp.util.get_effective_tabstop', function()
|
||||
local function test_tabstop(tabsize, shiftwidth)
|
||||
exec_lua(string.format([[
|
||||
vim.api.nvim_buf_set_option(0, 'shiftwidth', %d)
|
||||
vim.api.nvim_buf_set_option(0, 'tabstop', 2)
|
||||
vim.bo.shiftwidth = %d
|
||||
vim.bo.tabstop = 2
|
||||
]], shiftwidth))
|
||||
eq(tabsize, exec_lua('return vim.lsp.util.get_effective_tabstop()'))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user