Closed nbfhscl closed 2 years ago
I haven't been able to reproduce this exact error. Instead, when I try to watch a variable while debugging a standalone class, I get this error:
Result: Cannot evaluate because of compilation error(s): args cannot be resolved to a variable.
What versions are you using?
What versions are you using?
I finally find projectName from path ~/.config/coc/extensions/coc-java-data/jdt_ws_85743e4f846fbd6d835ffe5eb77b8e60/leetcode_fb720b0e/bin/
, where all my source files in the same folder is automatically copied into.
after set projectName in .vimspector.json to "leetcode_fb720b0e", I get the same error as you do.
*- Result: Cannot evaluate because of compilation error(s): i cannot be resolved to a variable.
Maybe you should create one more standardalone main class in same folder and the coc-java extension will require you to provide projectName parameter to distinguish between different java projects.
I had already tried the generated project name. The project name seems to be there for disambiguation when there are duplicate class names across multiple loaded projects. In the case of the standalone file the project name is derived from the parent directory name and appears to remain the same for each Java file.
I can replicate this same error while attaching with the remote debugger in VSCode under certain scenarios. That said it could still just be a missing config parameter. It will take more debugging to track it down.
After update all my coc extentions, the variables windows displays all the local variables, which is not before in my case. So temporarily no big problem for small java program debuging.
But still wish the "projectName" problem and the " Cannot evaluate because of compilation error(s): Evaluations must contain either an expression or a block of well-formed statements" problem could be solved.
What I've determined is that the scope and the watch get populated correctly when the classpath is specified while remote debugging a standalone Java file. This leads me to believe there may be a bug in jdt.ls or the java debug plugin when dealing with standalone files.
This works as expected:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5005 -cp "/Users/dan/.config/coc/extensions/coc-java-data/jdt_ws_133853e2933a3936a61aee74e647f114/hello-standalone-debug_d082081e/bin" Hello foo
This results in "compilation" and other problems in the watch:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5005 Hello.java foo
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed due to lack of activity.
Describe the issue can not get evalution work when debuging single class program without maven or gradel support.
I found this in vscode doc
and this in vscode-java-debug repo
when debuging in vscode, the projectName will be automatically generated, something like "test_c3ac9756" for example.
I tried some possible projectNames, but none of them could work.
To Reproduce
Expected behavior able to watch expression. maybe get the ${projectName) like ${adapterPort}.
Versions of relevant software
Relevant logs and error messages
:CocCommand java.debug.vimspector.start
Do you see a message like[coc.nvim] Java debug server started on port
in the output of:messages
? yes