Skip to content

Commit 8f7d45a

Browse files
committed
chore: nvim 0.10 fixes
We start testing against nightly lua lsp was complaining about usage of deprecated feature
1 parent ca14c8c commit 8f7d45a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ have to leave Neovim!
2323
2424
## Notices
2525

26+
- **2023-07-12**: tagged 0.2 release before changes for 0.10 compatibility
2627
- **2021-11-04**: HTTP Tree-Sitter parser now depends on JSON parser for the JSON bodies detection,
2728
please install it too.
2829
- **2021-08-26**: We have deleted the syntax file for HTTP files to start using the tree-sitter parser instead,

lua/rest-nvim/curl/init.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ M.get_or_create_buf = function()
4040
local existing_bufnr = vim.fn.bufnr(tmp_name)
4141
if existing_bufnr ~= -1 then
4242
-- Set modifiable
43-
vim.api.nvim_buf_set_option(existing_bufnr, "modifiable", true)
43+
vim.api.nvim_set_option_value(existing_bufnr, "modifiable", true)
4444
-- Prevent modified flag
45-
vim.api.nvim_buf_set_option(existing_bufnr, "buftype", "nofile")
45+
vim.api.nvim_set_option_value(existing_bufnr, "buftype", "nofile")
4646
-- Delete buffer content
4747
vim.api.nvim_buf_set_lines(
4848
existing_bufnr,
@@ -53,16 +53,17 @@ M.get_or_create_buf = function()
5353
)
5454

5555
-- Make sure the filetype of the buffer is httpResult so it will be highlighted
56-
vim.api.nvim_buf_set_option(existing_bufnr, "ft", "httpResult")
56+
vim.api.nvim_set_option_value("ft", "httpResult", { buf = existing_bufnr } )
5757

5858
return existing_bufnr
5959
end
6060

6161
-- Create new buffer
6262
local new_bufnr = vim.api.nvim_create_buf(false, "nomodeline")
6363
vim.api.nvim_buf_set_name(new_bufnr, tmp_name)
64-
vim.api.nvim_buf_set_option(new_bufnr, "ft", "httpResult")
65-
vim.api.nvim_buf_set_option(new_bufnr, "buftype", "nofile")
64+
vim.api.nvim_set_option_value("ft", "httpResult", { buf = new_bufnr })
65+
vim.api.nvim_set_option_value("buftype", "nofile", { buf = new_bufnr })
66+
6667

6768
return new_bufnr
6869
end
@@ -194,7 +195,7 @@ local function create_callback(curl_cmd, method, url, script_str)
194195
end
195196
vim.cmd(cmd_split .. res_bufnr)
196197
-- Set unmodifiable state
197-
vim.api.nvim_buf_set_option(res_bufnr, "modifiable", false)
198+
vim.api.nvim_set_option_value("modifiable", false, { buf = res_bufnr })
198199
end
199200

200201
-- Send cursor in response buffer to start

0 commit comments

Comments
 (0)