From 8f7d45a473281fb6f40dca85d0dfcfefe3d3b08f Mon Sep 17 00:00:00 2001 From: Matthieu Coudron <886074+teto@users.noreply.github.com> Date: Sun, 16 Jul 2023 00:08:48 +0200 Subject: [PATCH] chore: nvim 0.10 fixes We start testing against nightly lua lsp was complaining about usage of deprecated feature --- README.md | 1 + lua/rest-nvim/curl/init.lua | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cd3d6d12..2489c556 100644 --- a/README.md +++ b/README.md @@ -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, diff --git a/lua/rest-nvim/curl/init.lua b/lua/rest-nvim/curl/init.lua index fd488389..8a1bd2d6 100644 --- a/lua/rest-nvim/curl/init.lua +++ b/lua/rest-nvim/curl/init.lua @@ -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, @@ -53,7 +53,7 @@ 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 @@ -61,8 +61,9 @@ M.get_or_create_buf = function() -- 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 @@ -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