mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
Use wrapper around vim.notify with common options
Ref https://github.com/nvim-treesitter/nvim-treesitter/pull/1927#issuecomment-947064843
This commit is contained in:
parent
97819053c8
commit
55860a76d9
3 changed files with 9 additions and 3 deletions
|
|
@ -239,7 +239,7 @@ function M.edit_query_file(query_group, lang)
|
||||||
lang = lang or parsers.get_buf_lang()
|
lang = lang or parsers.get_buf_lang()
|
||||||
local files = ts_query.get_query_files(lang, query_group, true)
|
local files = ts_query.get_query_files(lang, query_group, true)
|
||||||
if #files == 0 then
|
if #files == 0 then
|
||||||
vim.notify "No query file found! Creating a new one!"
|
utils.notify "No query file found! Creating a new one!"
|
||||||
M.edit_query_file_user_after(query_group, lang)
|
M.edit_query_file_user_after(query_group, lang)
|
||||||
elseif #files == 1 then
|
elseif #files == 1 then
|
||||||
vim.cmd(":edit " .. files[1])
|
vim.cmd(":edit " .. files[1])
|
||||||
|
|
|
||||||
|
|
@ -429,13 +429,13 @@ function M.update(options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if installed == 0 then
|
if installed == 0 then
|
||||||
vim.notify "Parsers are up-to-date!"
|
utils.notify "Parsers are up-to-date!"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local parsers_to_update = configs.get_update_strategy() == "lockfile" and outdated_parsers()
|
local parsers_to_update = configs.get_update_strategy() == "lockfile" and outdated_parsers()
|
||||||
or info.installed_parsers()
|
or info.installed_parsers()
|
||||||
if #parsers_to_update == 0 then
|
if #parsers_to_update == 0 then
|
||||||
vim.notify "All parsers are up-to-date!"
|
utils.notify "All parsers are up-to-date!"
|
||||||
end
|
end
|
||||||
for _, lang in pairs(parsers_to_update) do
|
for _, lang in pairs(parsers_to_update) do
|
||||||
install {
|
install {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,12 @@ local luv = vim.loop
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
-- Wrapper around vim.notify with common options set.
|
||||||
|
function M.notify(msg, log_level, opts)
|
||||||
|
local default_opts = { title = "nvim-treesitter" }
|
||||||
|
vim.notify(msg, log_level, vim.tbl_extend("force", default_opts, opts or {}))
|
||||||
|
end
|
||||||
|
|
||||||
function M.setup_commands(mod, commands)
|
function M.setup_commands(mod, commands)
|
||||||
for command_name, def in pairs(commands) do
|
for command_name, def in pairs(commands) do
|
||||||
local call_fn = string.format(
|
local call_fn = string.format(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue