puremourning / vimspector

vimspector - A multi-language debugging system for Vim
http://puremourning.github.io/vimspector-web
Apache License 2.0
4.08k stars 171 forks source link

How to use vscode-java-debug adapter to debug java application #825

Closed tianya888 closed 8 months ago

tianya888 commented 8 months ago

Description

I want to debug Java code using vimspector with the vscode-java-debug adapter. However, I have encountered some issues and I would appreciate some help in resolving them.

Initially, I was using the java-language-server debugger, which runs fine but lacks some functionality. For example, the evaluate method of JavaDebugServer is not implemented, and setting variable values is not successful. I'm not sure if I am using it incorrectly or if there is a better way to handle this.

So, I switched to the vscode-java-debug adapter. However, I noticed that there is very little documentation for this adapter on the GitHub project. I am encountering an error, as shown in the screenshot, and I would appreciate guidance on identifying the problem.

How to correctly use the vscode-java-debug debugger?

Thank you.

![Uploading 截图_20240115183731.png…]()

Is it reproducible in vim?

Reproducible in Vim

Works with clean config?

Yes

Sample project works?

Reproducible with sample project

Minimal Reproduction

List of steps to reproduce:

  1. Run vim -Nu ~/Desktop/vimspector/tests/vimrc --cmd "let g:vimspector_enable_mappings='VISUAL_STUDIO'"
  2. connected, send initial cmd,
  3. then , The server has denied access.

Expected Behaviour

It can run normally.

Actual Behaviour

It cannot run normally.

Additional information

No response

Installation Type

Plugin Manager (git clone)

Vimspector version

master

Debug Info

No response

Log file

No response

Vim version

8.2.5172

Python version

No response

Neovim diagnostics

No response

Operating System

No response

Declaration

puremourning commented 8 months ago

Documentation for using it with YCM is in vimspector README.

Usage with other language servers is down to you sorry.

https://github.com/puremourning/vimspector#java

tianya888 commented 8 months ago

Thank you very much for your response. Unfortunately, due to certain reasons, I can only use the inspector. So I still want to know how to directly use the inspector and the vscode-java-debug adapter to debug Java code. Can you give me some tips? Thank you!

puremourning commented 8 months ago

As I said, vscode-java-debug is a plugin for jdt.ls language server. You need a language server client like YCM to use it.

There is nothing about this which is in vimspector control.

As this is neither a bug nor feature request I’m converting to discussion.