Shatur / neovim-tasks

A statefull task manager focused on integration with build systems.
GNU General Public License v3.0
108 stars 10 forks source link

error running cmake run #2

Closed matebeulm closed 2 years ago

matebeulm commented 2 years ago

Thanks for your effort with this new plugin. I tried to use it instead of neovim-cmake. But while I can execute the cmake configure and cmake build tasks, I get an error when I execute the run task:

Task start cmake run

The error I get in neovim 0.8 is:

Error executing luv callback: vim/_editor.lua:0: E5560: nvim_err_writeln must not be called in a lua loop callback stack traceback: [C]: in function 'nvim_err_writeln' vim/_editor.lua: in function 'notify' .../site/pack/packer/start/neovim-tasks/lua/tasks/utils.lua:10: in function 'notify' ...ack/packer/start/neovim-tasks/lua/tasks/module/cmake.lua:180: in function 'command' ...site/pack/packer/start/neovim-tasks/lua/tasks/runner.lua:101: in function 'chain_commands' ...site/pack/packer/start/neovim-tasks/lua/tasks/runner.lua:168: in function 'fn' ...im/site/pack/packer/opt/plenary.nvim/lua/plenary/job.lua:594: in function 'v' ...im/site/pack/packer/opt/plenary.nvim/lua/plenary/job.lua:244: in function '_shutdown' ...im/site/pack/packer/opt/plenary.nvim/lua/plenary/job.lua:46: in function <...im/site/pack/p acker/opt/plenary.nvim/lua/plenary/job.lua:37> [C]: in function 'nvim_command' ...site/pack/packer/start/neovim-tasks/lua/tasks/runner.lua:146: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>

Here is the project to reproduce. It works perfectly fine with the old cmake plugin.

CMakeLists.txt

cmake_minimum_required(VERSION 3.24)

project(test LANGUAGES CXX)

add_executable(test)

target_compile_features(test PRIVATE cxx_std_20)

target_sources(test PRIVATE main.cpp)

main.cpp

#include <iostream>
#include <string>

int main()
{
  std::string user{"Matthias"};
  std::cout << "hallo, " << user << "!" << std::endl;

  return EXIT_SUCCESS;
}
Shatur commented 2 years ago

Can't reproduce, the following commands works for me:

Task start cmake configure
Task start cmake build
Task set_module_param cmake target
Task start cmake run
matebeulm commented 2 years ago

That works for me, too It is :Task start cmake run that causes the error

------ Original Message ------ From "Hennadii Chernyshchyk" @.> To "Shatur/neovim-tasks" @.> Cc "Matthias Eberhardt" @.>; "Author" @.> Date 2022-10-26 00:29:13 Subject Re: [Shatur/neovim-tasks] error running cmake run (Issue #2)

Can't reproduce, the command :Task start cmake configure configures project successfully.

— Reply to this email directly, view it on GitHub https://github.com/Shatur/neovim-tasks/issues/2#issuecomment-1291208849, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJ42NPM72MXGEYG3SULEGTWFBNLTANCNFSM6AAAAAAROKMJWU. You are receiving this because you authored the thread.Message ID: @.***>

Shatur commented 2 years ago

Can't reproduce on my machine. Maybe other plugins are causing this?

AlexAUT commented 2 years ago

The issues happens when you forget Task set_module_param cmake target (no target set in neovim.json) before running/debugging.

Shatur commented 2 years ago

Tried the following on a new project without settings but no such error:

:Task start cmake configure
:Task start cmake run

it says No selected target, please set "target" parameter, but it's expected.

AlexAUT commented 2 years ago

Interesting I get the error https://asciinema.org/a/krw39Xl33dfLUX8oISlMXKLFg

Maybe it is related to the neovim version? Tried with 0.8.1 and the latest master.

Shatur commented 2 years ago

I also have 0.8.1 on ArchLinux. What OS are you using?

AlexAUT commented 2 years ago

Arch Linux everything up to date.

Shatur commented 2 years ago

Hm... Are you sure that you using the latest version of https://github.com/rcarriga/nvim-notify? It looks like this plugin is causing the error judging by the log.

AlexAUT commented 2 years ago

I wasn't using this plugin at all. Installing it fixed the issue => see the expected error message in a message box. So the default vim.notify causes the problem?

Shatur commented 2 years ago

It looks like it is! I think we should try use vim.schedule_wrap here: https://github.com/Shatur/neovim-tasks/blob/75a548c7a16d84548ad71ec2d25ddffe973f5a1e/lua/tasks/runner.lua#L168 Could you try it and send a PR if it works? I currently at work.