cdelledonne / vim-cmake

Vim/Neovim plugin for working with CMake projects
MIT License
259 stars 21 forks source link

console window is blank for CMakeGenerate and CMakeBuild #93

Closed FarsanRashid closed 10 months ago

FarsanRashid commented 10 months ago

Thank you for creating this nice plugin!

Bug description

console window does not show output of cmake for CMakeGenerate and CMakeBuild. cmake is invoked and works as expected, only logs are not shown in console window. The issue is similar to an old issue.

To Reproduce

Run :CMakeGenerate or :CMakeBuild with default config

Expected behavior

cmake logs are shown in console window as shown in README

Other info

Additional context

CMakeRun shows output of executable in overlay window. Not familiar with vimscript but looks like CMakeRun is invoking function! s:terminal.RunOverlay whereas CMakeBuild and CMakeGenerate invokes function! s:terminal.Run

log from log_level TRACE

[2023-12-21 22:35:48] [DEBUG] API invoked: cmake#Build(0, ['alternating_array']) [2023-12-21 22:35:48] [DEBUG] Invoked: build.Build(0, ['alternating_array']) [2023-12-21 22:35:48] [DEBUG] Invoked: terminal.Run(['cmake', '--build', 'build', '--target', 'alternating_array'], 'BUILD', {'callbacks_succ': [function('175_GenerateQuickfix'), function('175_RefreshTargets')], 'autocmds_pre': ['CMakeBuildPre'], 'autocmds_succ': ['CMakeBuildSucceeded'], 'callbacks_err': [function('175_GenerateQuickfix'), function('175_RefreshTargets')], 'autocmds_err': ['CMakeBuildFailed']}) [2023-12-21 22:35:48] [DEBUG] Invoked: terminal.CloseOverlay() [2023-12-21 22:35:48] [DEBUG] Invoked: terminal.Open(v:false, v:false) [2023-12-21 22:35:48] [DEBUG] Executing autocmd CMakeBuildPre [2023-12-21 22:35:49] [DEBUG] Invoked console exit callback [2023-12-21 22:35:50] [DEBUG] Callback invoked: 175_GenerateQuickfix() [2023-12-21 22:35:50] [DEBUG] Invoked: s:quickfix.Generate() [2023-12-21 22:35:50] [DEBUG] Replaced existing Quickfix list [2023-12-21 22:35:50] [DEBUG] Callback invoked: 175_RefreshTargets() [2023-12-21 22:35:50] [DEBUG] Executing autocmd CMakeBuildSucceeded

cdelledonne commented 10 months ago

Hi, thanks for reporting this!

I can't seem to reproduce this in Vim on Linux, so it's either related to macOS or to your configuration. Have you tried reproducing this with a minimal vimrc? Also, does anything happen at all when invoking :CMakeGenerate? Does the Vim-CMake window open? Is the content of the buffer in the Vim-CMake window completely empty?

As I said, this might very well be related to macOS, so I will also try to get a hold of a macOS system and try to reproduce your issue.

FarsanRashid commented 10 months ago

Hi, I tried with the following minimal .vimrc

call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
Plug 'cdelledonne/vim-cmake'
call plug#end()

and recored the screen

https://github.com/cdelledonne/vim-cmake/assets/8214491/db39f4b3-48a2-4eca-9661-e446ceff0755

As you can see, both CMakeGenerate and CMakeBuild opens the console window. I believe the content of the buffer in the Vim-CMake window is completely empty.

cdelledonne commented 10 months ago

Thanks for the additional input.

The issue is subtle, and it seems to indeed only manifest itself on macOS. Basically using the built-in Vim function writefile() to write to Vim-CMake's console is not working properly. I added a workaround on branch 93-console-window-is-blank-for-cmakegenerate-and-cmakebuild — can you please try and check out that branch and see if the issue is resolved?

FarsanRashid commented 10 months ago

Working for both CMakeGenerate and CMakeBuild.

Thanks a lot!

cdelledonne commented 10 months ago

Cool, I'll merge on master then!