Skip to content

Commit

Permalink
chore: nvim 0.10 fixes
Browse files Browse the repository at this point in the history
We start testing against nightly
lua lsp was complaining about usage of deprecated feature
  • Loading branch information
teto committed Jul 15, 2023
1 parent ca14c8c commit 8f7d45a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ have to leave Neovim!
## Notices

- **2023-07-12**: tagged 0.2 release before changes for 0.10 compatibility
- **2021-11-04**: HTTP Tree-Sitter parser now depends on JSON parser for the JSON bodies detection,
please install it too.
- **2021-08-26**: We have deleted the syntax file for HTTP files to start using the tree-sitter parser instead,
Expand Down
13 changes: 7 additions & 6 deletions lua/rest-nvim/curl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ M.get_or_create_buf = function()
local existing_bufnr = vim.fn.bufnr(tmp_name)
if existing_bufnr ~= -1 then
-- Set modifiable
vim.api.nvim_buf_set_option(existing_bufnr, "modifiable", true)
vim.api.nvim_set_option_value(existing_bufnr, "modifiable", true)
-- Prevent modified flag
vim.api.nvim_buf_set_option(existing_bufnr, "buftype", "nofile")
vim.api.nvim_set_option_value(existing_bufnr, "buftype", "nofile")
-- Delete buffer content
vim.api.nvim_buf_set_lines(
existing_bufnr,
Expand All @@ -53,16 +53,17 @@ M.get_or_create_buf = function()
)

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

return existing_bufnr
end

-- Create new buffer
local new_bufnr = vim.api.nvim_create_buf(false, "nomodeline")
vim.api.nvim_buf_set_name(new_bufnr, tmp_name)
vim.api.nvim_buf_set_option(new_bufnr, "ft", "httpResult")
vim.api.nvim_buf_set_option(new_bufnr, "buftype", "nofile")
vim.api.nvim_set_option_value("ft", "httpResult", { buf = new_bufnr })
vim.api.nvim_set_option_value("buftype", "nofile", { buf = new_bufnr })


return new_bufnr
end
Expand Down Expand Up @@ -194,7 +195,7 @@ local function create_callback(curl_cmd, method, url, script_str)
end
vim.cmd(cmd_split .. res_bufnr)
-- Set unmodifiable state
vim.api.nvim_buf_set_option(res_bufnr, "modifiable", false)
vim.api.nvim_set_option_value("modifiable", false, { buf = res_bufnr })
end

-- Send cursor in response buffer to start
Expand Down

0 comments on commit 8f7d45a

Please sign in to comment.