fix: add version check for nvim_set_option_value and nvim_get_option_value

This commit is contained in:
27Onion Nebell
2025-04-18 16:33:09 +08:00
parent 7d2387dc12
commit e93286a489
11 changed files with 110 additions and 51 deletions

View File

@@ -15,11 +15,13 @@ local M = {
name = 'markdown',
}
local utils = require('outline.utils')
---@param bufnr integer
---@param config table?
---@return boolean ft_is_markdown
function M.supports_buffer(bufnr, config)
local ft = vim.api.nvim_get_option_value('ft', { buf = bufnr })
local ft = utils.buf_get_option(bufnr, 'ft')
if config and config.filetypes then
for _, ft_check in ipairs(config.filetypes) do
if ft_check == ft then

View File

@@ -17,11 +17,12 @@ local M = {
]
]],
}
local utils = require('outline.utils')
---@param bufnr integer
---@param config table?
function M.supports_buffer(bufnr, config)
if vim.api.nvim_get_option_value('ft', { buf = bufnr }) ~= 'norg' then
if utils.buf_get_option(bufnr, 'ft') ~= 'norg' then
return false
end

View File

@@ -1,6 +1,7 @@
local cfg = require('outline.config')
local jsx = require('outline.providers.jsx')
local lsp_utils = require('outline.utils.lsp')
local utils = require('outline.utils')
local l = vim.lsp
@@ -252,7 +253,7 @@ function M.show_hover(sidebar)
border = cfg.o.preview_window.border,
width = code_width,
})
vim.api.nvim_set_option_value('winhighlight', cfg.o.preview_window.winhl, { win = winnr })
utils.win_set_option(winnr, 'winhighlight', cfg.o.preview_window.winhl)
return true
end