Skip to content

Commit

Permalink
[fix] Correct logic and typo in Lua patterns handling
Browse files Browse the repository at this point in the history
- Updated condition to check if comment_prefix is an empty string instead of a nil value.
- Fixed a typo in task.lua from 'resulr' to 'result'.
  • Loading branch information
huantrinh1802 committed Sep 29, 2024
1 parent 021e493 commit 3431ef4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lua/m_taskwarrior_d/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,14 @@ local function process_opts(opts)
}
M._config["id_part_pattern"] = {
vim = "("
.. (M._config.comment_prefix and comment_prefix_encoded.vim .. " " or "")
.. (M._config.comment_prefix ~= "" and comment_prefix_encoded.vim .. " " or "")
.. "(\\$id{"
.. M._config.id_pattern.vim
.. "})"
.. (M._config.comment_suffix ~= "" and " " .. comment_suffix_encoded.vim or "")
.. ")",
lua = "("
.. (M._config.comment_prefix and comment_prefix_encoded.lua .. " " or "")
.. (M._config.comment_prefix ~= "" and comment_prefix_encoded.lua .. " " or "")
.. "(%$id{("
.. M._config.id_pattern.lua
.. ")})"
Expand All @@ -645,12 +645,12 @@ local function process_opts(opts)
}
M._config["task_query_pattern"] = {
vim = "("
.. (M._config.comment_prefix and comment_prefix_encoded.vim .. " " or "")
.. (M._config.comment_prefix ~= "" and comment_prefix_encoded.vim .. " " or "")
.. "(\\$query{([^\\|]*)|*([^}]*)})"
.. (M._config.comment_suffix ~= "" and " " .. comment_suffix_encoded.vim or "")
.. ")",
lua = "("
.. (M._config.comment_prefix and comment_prefix_encoded.lua .. " " or "")
.. (M._config.comment_prefix ~= "" and comment_prefix_encoded.lua .. " " or "")
.. "(%$query{([^%|]*)|*([^}]*)})"
.. (M._config.comment_suffix ~= "" and " " .. comment_suffix_encoded.lua or "")
.. ")",
Expand Down
2 changes: 1 addition & 1 deletion lua/m_taskwarrior_d/task.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function M.get_task_by(task_id, return_data)
local task_info
if vim == nil then
local json = require("cjson")
task_info = json.decode(resulr)
task_info = json.decode(result)
else
task_info = vim.fn.json_decode(result)
end
Expand Down

0 comments on commit 3431ef4

Please sign in to comment.