Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report]: Please make it simple to setup #88

Closed
LinArcX opened this issue Jan 19, 2020 · 4 comments
Closed

[Bug report]: Please make it simple to setup #88

LinArcX opened this issue Jan 19, 2020 · 4 comments

Comments

@LinArcX
Copy link

LinArcX commented Jan 19, 2020

Is your feature request related to a problem? Please describe.
Hi. I'm not sure is it a bug report or feature request! But let me first thank you for neovim support. I'm so glad to see that PR merged eventually. :)

I read README file and these instructions for setting up vimspector.

But after reading some lines, let me confess: I got confused!
First, please update README and that page, becuase there are some differences for setting up in vim vs neovim. For example here:

Untar the release tarball for your OS into $HOME/.vim/pack:

I downloaded latest release tarball and i don't have any idea where should i put it and what should i do after that! Actually you said:

Configure your project's debug profiles (create .vimspector.json)

But i don't have any idea how do that.

Please, please make the installation process easier.

@LinArcX
Copy link
Author

LinArcX commented Jan 20, 2020

OK. I figured it out how to simply install it(On Gnu/linux machines actually):

  1. If you are using plugin managers like vim-plug, add this line to your init.vim:
    Plug 'puremourning/vimspector'

  2. Run this command:
    :PlugInstall

  3. vimspector now exists in this directory:
    /home/$USER/.config/nvim/plugged/vimspector/

  4. To install gadgets, go to that directory and start installing some gadgets(For instance i installed vscode-cpptools gadget):
    ./install_gadget.py --enable-c

  5. Now go to your project and create a file called .vimspector.json and put these lines into it:

{
  "configurations": {
    "<name>: Launch": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "name": "<name>",
        "type": "cppdbg",
        "request": "launch",
        "program": "<path to binary>",
        "args": [ ... ],
        "cwd": "<working directory>",
        "environment": [ ... ],
        "externalConsole": true,
        "MIMode": "lldb"
      }
    },
    "<name>: Attach": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "name": "<name>: Attach",
        "type": "cppdbg",
        "request": "attach",
        "program": "<path to binary>",
        "MIMode": "lldb"
      }
    }
    ...
  }
}

Tip: Don't forget to specify the actual path of compiled program with debug symbols.

Till now i can set breakpoints with:call vimspector#ToggleBreakpoint(), But if i try to start debugging :call vimspector#Launch(), i'll get these error message:s

Error detected while processing function vimspector#Launch[1]..provider#python3#Call:                                                                  
line   18:                                                                                                                                             
Error invoking 'python_execute' on channel 6 (python3-script-host):                                                                                    
Traceback (most recent call last):                                                                                                                     
  File "<string>", line 1, in <module>                                                                                                                 
  File "/home/linarcx/.config/nvim/plugged/vimspector/python3/vimspector/debug_session.py", line 93, in Start                                          
    database = json.load( f )                                                                                                                          
  File "/usr/lib/python3.8/json/__init__.py", line 293, in load                                                                                        
    return loads(fp.read(),                                                                                                                            
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads                                                                                       
    return _default_decoder.decode(s)                                                                                                                  
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode                                                                                       
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())                                                                                                  
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode                                                                                   
    raise JSONDecodeError("Expecting value", s, err.value) from None                                                                                   
json.decoder.JSONDecodeError: Expecting value: line 10 column 19 (char 285)                                                                            
Press ENTER or type command to continue 

@LinArcX
Copy link
Author

LinArcX commented Jan 20, 2020

With help of this site, i've found out that my .vimspector.json file is incorrect. This is correct one:

{
  "configurations": {
    "<name>: Launch": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "name": "<name>",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceRoot}/debug/neodm",
        "cwd": "${workspaceRoot}",
        "externalConsole": true,
        "stopAtEntry": true,
        "MIMode": "gdb"
      }
    },
    "<name>: Attach": {
      "adapter": "vscode-cpptools",
      "configuration": {
        "name": "<name>: Attach",
        "type": "cppdbg",
        "request": "attach",
        "program": "${workspaceRoot}/debug/neodm",
        "MIMode": "gdb"
      }
    }
  }
}

And now everything works like a charm. :)

@oblitum
Copy link

oblitum commented Jan 20, 2020

Example VIM-PLUG auto install/update:

Plug 'puremourning/vimspector', {'do': './install_gadget.py --enable-c --enable-python'}

@puremourning
Copy link
Owner

Installation is as easy as any other vim plugin. Configuration is no more difficult than VSCode. I’m 1 person and they are Microsoft, so while I’m open to suggestions, they will need to be more specific.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants