Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plugin/hmts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ end
---@param predicate string[]
---@return boolean
local function hmts_path_handler(match, _, bufnr, predicate)
local node = match[predicate[2]]:parent()
local captured = match[predicate[2]]
if type(captured) == "table" then captured = captured[1] end
if not captured then return false end
local node = captured:parent()
local target_path = vim.list_slice(predicate, 3, nil)

while node do
Expand Down Expand Up @@ -153,6 +156,8 @@ end
---@param metadata table<string, string>
local function hmts_inject_handler(match, _, bufnr, predicate, metadata)
local path_node = match[predicate[2]]
if type(path_node) == "table" then path_node = path_node[1] end
if not path_node then return end
local filename = find_filename_in_parent_node(path_node, bufnr)
local alias = vim.filetype.match({ filename = filename })

Expand Down