feat: improve UX with vim.notify (#1763)

* fix(notify): don't report request on new line

* ref(notify): update message format

* ref(msgs): always quote values + decrease duplication

* fix(ci): undefined variables

* ref(actions): temporary silent actions.__index errors

* cleanup

* revert: panic effort, we continue to use error for those

Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
This commit is contained in:
tami5
2022-03-13 20:11:27 +03:00
committed by GitHub
parent 75b5730432
commit ef7b6ada6d
17 changed files with 311 additions and 116 deletions

View File

@@ -163,10 +163,10 @@ files.find_files = function(opts)
end)()
if not find_command then
print(
"You need to install either find, fd, or rg. "
.. "You can also submit a PR to add support for another file finder :)"
)
utils.notify("builtin.find_files", {
msg = "You need to install either find, fd, or rg",
level = "ERROR",
})
return
end
@@ -267,13 +267,19 @@ files.treesitter = function(opts)
local has_nvim_treesitter, _ = pcall(require, "nvim-treesitter")
if not has_nvim_treesitter then
print "You need to install nvim-treesitter"
utils.notify("builtin.treesitter", {
msg = "User need to install nvim-treesitter needs to be installed",
level = "ERROR",
})
return
end
local parsers = require "nvim-treesitter.parsers"
if not parsers.has_parser(parsers.get_buf_lang(opts.bufnr)) then
print "No parser for the current buffer"
utils.notify("builtin.treesitter", {
msg = "No parser for the current buffer",
level = "ERROR",
})
return
end
@@ -397,7 +403,10 @@ end
files.tags = function(opts)
local tagfiles = opts.ctags_file and { opts.ctags_file } or vim.fn.tagfiles()
if vim.tbl_isempty(tagfiles) then
print "No tags file found. Create one with ctags -R"
utils.notify("builtin.tags", {
msg = "No tags file found. Create one with ctags -R",
level = "ERROR",
})
return
end