From 5516ece73f9a0a0b6383cb480dd63924769b3dfc Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Thu, 26 Mar 2026 23:23:31 +0000 Subject: [PATCH] switch to mini.notify --- nvim/lua/darcula/flutter/init.lua | 58 ++++++++++++++----------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/nvim/lua/darcula/flutter/init.lua b/nvim/lua/darcula/flutter/init.lua index b5fda7a..4f58b3b 100644 --- a/nvim/lua/darcula/flutter/init.lua +++ b/nvim/lua/darcula/flutter/init.lua @@ -24,18 +24,19 @@ local conf = require("telescope.config").values local finders = require("telescope.finders") local global_state = require("telescope.state") local pickers = require("telescope.pickers") +local symbols = require("darcula.utils.symbols") local utils = require("darcula.utils") local utils_os = require("darcula.utils.os") local M = {} -local companion_title = "Flutter Companion" + +local spinner_id = nil local config = { use_coc = true } local callbacks = {nil, nil} local flutter_busy = false -local spinner_frames = {"⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"} local EMULATOR = 1 local DEVICE = 2 @@ -59,14 +60,10 @@ local flutter_run_device = function(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 - } + "Run device requires 'coc-flutter/coc-flutter-tools' if using CoC or 'flutter-tools.nvim' if using native LSP.", + vim.log.levels.ERROR ) end @@ -169,33 +166,36 @@ local function list_emulators(callback) end local start_spinner = function(name, get_active) - local spinner = 0 - local record - + local icon_idx = 0 local function update_spinner() if get_active() then - local next_record = - vim.notify( - "Detecting " .. name .. "...", - "info", - { - title = companion_title, - hide_from_history = true, - icon = spinner_frames[(spinner % #spinner_frames) + 1], - replace = record - } - ) - record = next_record - spinner = spinner + 1 + local msg = + "Detecting " .. + name .. "... " .. symbols.spinner[(icon_idx % #symbols.spinner) + 1] + + if spinner_id == nil then + spinner_id = MiniNotify.add(msg, "INFO") + else + MiniNotify.update( + spinner_id, + { + msg = msg + } + ) + end + + icon_idx = icon_idx + 1 vim.defer_fn(update_spinner, 100) end end + update_spinner() end local stop_spinner = function(set_inactive) set_inactive() - vim.notify.dismiss() + MiniNotify.remove(spinner_id) + spinner_id = nil end function M.flutter_clear(is_emulator) @@ -250,11 +250,7 @@ function M.flutter_list(is_emulators) ) if #items == 0 then - vim.notify( - "No " .. name .. " were found", - "error", - {title = companion_title} - ) + vim.notify("No " .. name .. " were found", vim.log.levels.ERROR) else global_state.set_global_key("selected_entry", nil)