error notifications

This commit is contained in:
Scott E. Graves 2022-07-29 13:17:05 -05:00
parent cccd7110f4
commit 6bdbcbcbd3

View File

@ -8,6 +8,7 @@ local global_state = require("telescope.state")
local utils = require("nvim-flutter-companion.utils") local utils = require("nvim-flutter-companion.utils")
local M = {} local M = {}
local companion_title = "Flutter Companion"
local config = { local config = {
use_coc = true use_coc = true
} }
@ -34,7 +35,19 @@ local flutter_run_device = function(id)
return return
end end
if vim.fn.exists(":FlutterRun") ~= 0 then
vim.api.nvim_command("FlutterRun -d " .. id) vim.api.nvim_command("FlutterRun -d " .. id)
return
end
vim.notify(
{
"Run device requires 'coc-flutter/coc-flutter-tools' if using CoC or 'flutter-tools.nvim' if using native LSP."
},
"error",
{
title = companion_title
}
)
end end
local load_table = function(path) local load_table = function(path)
@ -142,11 +155,11 @@ local start_spinner = function(name, get_active)
local function update_spinner() local function update_spinner()
if get_active() then if get_active() then
local next_record = local next_record =
require("notify").notify( vim.notify(
"Detecting " .. name .. "...", "Detecting " .. name .. "...",
"info", "info",
{ {
title = "Flutter Action", title = companion_title,
hide_from_history = true, hide_from_history = true,
icon = spinner_frames[(spinner % #spinner_frames) + 1], icon = spinner_frames[(spinner % #spinner_frames) + 1],
replace = record replace = record
@ -201,7 +214,7 @@ function M.flutter_list(is_emulators)
) )
if #items == 0 then if #items == 0 then
vim.notify("No " .. name .. " were found", "error", {title = "Flutter Action"}) vim.notify("No " .. name .. " were found", "error", {title = companion_title})
else else
global_state.set_global_key("selected_entry", nil) global_state.set_global_key("selected_entry", nil)