am trying to get Java debugging to work with Vim. I really want to get practice using a debugger as I upto now have used only print statement debugging.
I'm also thinking of moving to neovim.
I've installed vim-lsp https://github.com/prabirshrestha/vim-lsp
I've installed vimspector - A multi language graphical debugger for Vim
I've installed Java Debug Server for Visual Studio Code https://github.com/microsoft/java-debug
I've installed Eclipse JDT Language Server https://github.com/eclipse/eclipse.jdt.ls
This is all following the blog post : https://urfoex.blogspot.com/2020/08/deb ... r-vim.html
Section Connecting with Vim:
All my effort was trying to get
Code: Select all
:call lsp#send_request('eclipse-jdt-ls', {'method': 'workspace/executeCommand', 'params': {'command': 'vscode.java.startDebugSession'}, 'on_notification': function('lsp#utils#error')})
This command did not work to full extent. I get the following error:
Error detected while processing function lsp#send_request[6]..
E716: Key not present in Dictionary: "eclipse-jdt-ls"
Anyway I got Eclipse JDT Language Server working I think.
when I run
Code: Select all
java \
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product \
-Dlog.level=ALL \
-noverify \
-Xmx1G \
-jar ./plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar \
-configuration ./config_linux \
-data /home/etc etc/Data/ \
--add-modules=ALL-SYSTEM \
--add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED
Code: Select all
{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"28 Nov 2021, 17:30:31 Main thread is waiting"}}
So I have edited .bashrc and added the environment variables I seem to need to add.
Code: Select all
#made for getting Ecliple.jdt.ls java language server to work, for debugging
#where jdt.ls client reads from
export STDIN_PIPE_NAME="JDTC_READ"
#where jdt.ls client writes to
export STDOUT_PIPE_NAME="JDTC_WRITE"
#
#port client reads
export STDIN_PORT="2005"
#port client writes to
export STDOUT_PORT="2006"
Code: Select all
{
"configurations": {
"Java Attach": {
"adapter": "vscode-java",
"configuration": {
"request": "attach",
"hostName": "${host}",
"port": "${2005}",
"projectName": "${Board}",
"sourcePaths": [
"${workspaceRoot}/src/main/java",
"${workspaceRoot}/src/test/java"
]
}
}
}
}
I try to enter the debugger screen by pressing F5. I put localhost as host, and 2005 as port, 2006 as DAPport, Board (main class name) as projectname, but I get 'Unable to start or connect to debug adapter'. Last log line gives : '81 2021-11-28 21:21:22,283 - INFO - Failed to launch or attach to the debug adapter'
I'm somewhat confused and not sure how to put these things together. Or if I even need something else. This day has been a lot of work above and I am not really close to getting the damn Java debugging working. It would be a nightmare to go through this kind of thing for every language I want to work with. Anyway if any of you are familiar with this can you point out a fault or a solution?