Coder Social home page Coder Social logo

Terminal mode: When checking if there is a process attached to terminal, it should not block neovim instance about cmake-tools.nvim HOT 7 CLOSED

civitasv avatar civitasv commented on July 17, 2024
Terminal mode: When checking if there is a process attached to terminal, it should not block neovim instance

from cmake-tools.nvim.

Comments (7)

Civitasv avatar Civitasv commented on July 17, 2024 1

Okay, hopefully someone can anwser it. 😄

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 17, 2024

Note to people using cmake_always_use_terminal=true

If you do not chaining of commands and vim.wait() to block your neovim instance, you can hit the CTRL C once or twice after launching the terminals.
This will lose the chained commands, but you can access neovim while the CMakeTask is running.


The reason we added this option is because:

  1. We want to keep the build output from all the commands, along with the commands persistent.
  2. And to view the exact commands that are being sent to the terminal on each run.
  3. We want to give full access to the user (users who donot use CMake Presets) to set/modify specific cmake flags to the terminal directly in the command line for quick experimentation.

Kindly provide feedback on this feature... 👋

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 17, 2024

Currently, I use these codes to check if there is a process is finished, which is need to chain callback.

https://github.com/Civitasv/cmake-tools.nvim/blob/3e5f768977a7825e70335feff2cfac56e54ac33b/lua/cmake-tools/terminal.lua#LL542C1-L560C6

But this will block neovim instance, we should find a non-blocking or async way to check this.

(Posible solution?)...

If we do a background non-blocking vim.wait() that looks inside the build directory every n milliseconds until the currently running cmake produces the CMakeCache.txt or something like that which tells the status of the cmake process is completed, once it finds this (effectively a more verbose on_success() condition), maybe even the timestamp of the file... We can then chain the next command with a small delay.

We will need to create new functions for checking status of files like how the codemodel targets are obatined...

Since the solution is cmake specific solution, I think this will be a decent solution without the explicit on_success() callback.

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 17, 2024

I've opened a question here: https://discourse.cmake.org/t/is-there-a-way-to-check-when-any-cmake-task-has-finished-purely-from-the-filesystem-build-directory/8271

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 17, 2024

Seems like this can be accomplished by writing a dummy query into a file.

@Civitasv, do you have any idea how we may do this?

from cmake-tools.nvim.

Civitasv avatar Civitasv commented on July 17, 2024

I've researched some plugins about terminal, cannot find a suitable solution to get notified when terminal executes commands successfully. But I find another way, See it at #63.

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 17, 2024

Nice! That is a simple and effective solution :D

from cmake-tools.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.