GustavEikaas / easy-dotnet.nvim

Neovim plugin written in Lua for working with .Net projects in Neovim. Makes it easier to run/test/build/debug projects. Supports both F# and C#
MIT License
86 stars 7 forks source link

add restore, build for testrunner #104

Closed GustavEikaas closed 1 month ago

GustavEikaas commented 1 month ago

Description

Will add the option to pass --no-build and --no-restore using the properties noBuild and noRestore in the test_runner options section

Features

Consider

GustavEikaas commented 1 month ago

Could probably extend the run_async with complementary spinner

local spinner_symbols = { '-', '\\', '|', '/' }
local spinner_index = 1
local spinner_timer = nil
local notify_id = nil

local function update_spinner()
  if spinner_timer then
    notify_id = vim.notify('Processing ' .. spinner_symbols[spinner_index], vim.log.levels.INFO, {
      title = 'Progress',
      replace = notify_id,
    })
    spinner_index = (spinner_index % #spinner_symbols) + 1
  end
end

local function start_spinner()
  spinner_timer = vim.loop.new_timer()
  spinner_timer:start(0, 100, vim.schedule_wrap(update_spinner))
end

local function stop_spinner()
  if spinner_timer then
    spinner_timer:stop()
    spinner_timer:close()
    spinner_timer = nil
    vim.notify('Job finished!', vim.log.levels.INFO, {
      title = 'Progress',
      replace = notify_id,
    })
    notify_id = nil
  end
end

local function run_job_with_spinner(command)
  start_spinner()

  vim.fn.jobstart(command, {
    on_exit = function()
      vim.schedule(stop_spinner)
    end,
  })
end