From ef7b6ada6d91a1b2932492d78c730e4fc00cd2ea Mon Sep 17 00:00:00 2001 From: tami5 Date: Sun, 13 Mar 2022 20:11:27 +0300 Subject: 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 --- lua/telescope/builtin/files.lua | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lua/telescope/builtin/files.lua') diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 90e52f5..893588f 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -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 -- cgit v1.2.3