Skip to content

Commit

Permalink
fix: Fixed an issue caused by enable = false when getting options f…
Browse files Browse the repository at this point in the history
…rom `preview`
  • Loading branch information
OXY2DEV committed Jan 25, 2025
1 parent 6db389e commit 79539be
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lua/cmp-markview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local source = {};
--- Is this source available?
---@return boolean
function source:is_available()
local fts = require("markview.spec").get({ "preview", "filetypes" }, { fallback = {} });
local fts = require("markview.spec").get({ "preview", "filetypes" }, { fallback = {}, ignore_enable = true });
return vim.list_contains(fts, vim.bo.ft);
end

Expand Down
13 changes: 7 additions & 6 deletions lua/markview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ markview.actions = {
markview.state.splitview_buffer,
false,
spec.get({ "preview", "splitview_winopts", }, {
fallback = { split = "right" }
fallback = { split = "right" },
ignore_enable = true
})
);
end
Expand Down Expand Up @@ -798,7 +799,7 @@ markview.actions = {

local mode = vim.api.nvim_get_mode().mode;
---@type string[]
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

if vim.list_contains(hybd_modes, mode) == false then
health.__child_indent_de();
Expand Down Expand Up @@ -844,9 +845,9 @@ markview.actions = {

local mode = vim.api.nvim_get_mode().mode;
---@type string[]
local prev_modes = spec.get({ "preview", "modes" }, { fallback = {} });
local prev_modes = spec.get({ "preview", "modes" }, { fallback = {}, ignore_enable = true });
---@type string[]
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

if vim.list_contains(prev_modes, mode) == false then
health.__child_indent_de();
Expand Down Expand Up @@ -905,7 +906,7 @@ markview.actions = {

local mode = vim.api.nvim_get_mode().mode;
---@type string[]
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

if vim.list_contains(hybd_modes, mode) == false then
return;
Expand Down Expand Up @@ -946,7 +947,7 @@ markview.actions = {

local mode = vim.api.nvim_get_mode().mode;
---@type string[]
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybd_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

if vim.list_contains(hybd_modes, mode) == false then
return;
Expand Down
2 changes: 1 addition & 1 deletion lua/markview/filetypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ fts.get = function (ft)
end

local spec = require("markview.spec");
local provider_name = spec.get({ "preview", "icon_provider" }, { fallback = "internal" });
local provider_name = spec.get({ "preview", "icon_provider" }, { fallback = "internal", ignore_enable = true });
local conf = {};

if provider_name == "devicons" and pcall(require, "nvim-web-devicons") then
Expand Down
10 changes: 5 additions & 5 deletions lua/markview/spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ spec.default = {
---+${lua}

---@type string[]
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {} });
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {}, ignore_enable = true });
---@type string[]
local hybrid_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybrid_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

local concealcursor = "";

Expand All @@ -237,7 +237,7 @@ spec.default = {
---+${lua}

---@type string[]
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {} });
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {}, ignore_enable = true });
local concealcursor = "";

for _, mode in ipairs(preview_modes) do
Expand All @@ -257,9 +257,9 @@ spec.default = {
---+${lua}

---@type string[]
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {} });
local preview_modes = spec.get({ "preview", "modes" }, { fallback = {}, ignore_enable = true });
---@type string[]
local hybrid_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {} });
local hybrid_modes = spec.get({ "preview", "hybrid_modes" }, { fallback = {}, ignore_enable = true });

local concealcursor = "";

Expand Down

0 comments on commit 79539be

Please sign in to comment.