diff options
| author | Santos Gallegos <stsewd@protonmail.com> | 2021-10-22 16:25:18 -0500 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-10-22 23:46:16 +0200 |
| commit | 55860a76d90009f742d9ee300879541ab13ed9f9 (patch) | |
| tree | d224e33a6fa5be78dbc8a29e749e852154309806 /lua | |
| parent | Elixir: fix a few highlights, add ExUnit support to locals (#1933) (diff) | |
| download | nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar.gz nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar.bz2 nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar.lz nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar.xz nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.tar.zst nvim-treesitter-55860a76d90009f742d9ee300879541ab13ed9f9.zip | |
Use wrapper around vim.notify with common options
Ref https://github.com/nvim-treesitter/nvim-treesitter/pull/1927#issuecomment-947064843
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 2 | ||||
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 4 | ||||
| -rw-r--r-- | lua/nvim-treesitter/utils.lua | 6 |
3 files changed, 9 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index c18208ecb..30008fe9a 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -239,7 +239,7 @@ function M.edit_query_file(query_group, lang) lang = lang or parsers.get_buf_lang() local files = ts_query.get_query_files(lang, query_group, true) 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) elseif #files == 1 then vim.cmd(":edit " .. files[1]) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 936f36530..d57b48565 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -429,13 +429,13 @@ function M.update(options) end end if installed == 0 then - vim.notify "Parsers are up-to-date!" + utils.notify "Parsers are up-to-date!" end else local parsers_to_update = configs.get_update_strategy() == "lockfile" and outdated_parsers() or info.installed_parsers() if #parsers_to_update == 0 then - vim.notify "All parsers are up-to-date!" + utils.notify "All parsers are up-to-date!" end for _, lang in pairs(parsers_to_update) do install { diff --git a/lua/nvim-treesitter/utils.lua b/lua/nvim-treesitter/utils.lua index dcd1e135d..e6a6358a9 100644 --- a/lua/nvim-treesitter/utils.lua +++ b/lua/nvim-treesitter/utils.lua @@ -4,6 +4,12 @@ local luv = vim.loop 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) for command_name, def in pairs(commands) do local call_fn = string.format( |
