ilyachur/cmake4vim

Error when enabling vimspector support

Closed this issue · 3 comments

Describe the bug
When specifying g:cmake_vimspector_support=1 in init.vim and doing a :CMakeRun, I get the following error in neovim:

Error detected while processing function cmake4vim#RunTarget[20]..utils#config#vimspector#updateConfig[20]..<SNR>105_writeJson[7]..provider#python3#Call:
line   18:
Error invoking 'python_execute' on channel 8 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 2, in <module>
NameError: name 'vim' is not defined

Needless to say, the expected .vimspector.json file is not generated.

To Reproduce
Steps to reproduce the behavior:

  1. Set g:cmake_vimspector_support=1 in init.vim
  2. Open a CMake folder in neovim
  3. Do :CMake/:CMakeBuild followed by a :CMakeRun
  4. See cmake4vim output window

Expected behavior
Expecting no error message written and .vimspector.json to be generated.

Desktop (please complete the following information):

  • OS: Linux
  • Editor: nvim
  • Version: 0.6.1

Additional context
This error indicates a missing module in the Python snippet.
Looking at the corresponding function in vimspector.vim, I assume that an import statement is missing. Adding import vim next to import json fixes the issue.

@cemdervis Thank you for the issue.
Very strange that it works on CI and locally. Created PR #154.

@cemdervis PR was merged. Feel free to reopen the ticket if you still have an issue.

@ilyachur You're welcome, thanks for the fast fix!