Giter VIP home page Giter VIP logo

coc-java-debug's People

Contributors

dansomething avatar dependabot[bot] avatar gagara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coc-java-debug's Issues

Java class hotswap not working in debug model

Describe the issue
Hi,
Thanks for buiding this excellent extension to simplify our java debug in NVIM, I could have basic java debug in NVIM with limited configuration, cheers!!!

but i see java class hotswap function not working, is it not supported today?

I have set "let g:ycm_java_hotcodereplace_mode = 'always' as suggested from https://github.com/puremourning/vimspector#java

but it seems the java class cannot be hot-swapped in debug model.

See hotcodereplace message in vimspector log:
image

2022-03-26 20:54:50,921 - DEBUG - Message received: {'event': 'hotcodereplace', 'body': {'changeType': 'BUILD_COMPLETE', 'message': 'Build completed.', 'type': 'hotcodereplace'}, 'seq': 21, 'type': 'event'}

Multiple Vimspector debugging sessions at the same time?

I'm using coc-java-debug under NeoVim 0.4.4.

Now I'd like to debug a few applications at the same time since they communicate with each other via API requests and/or queues. However it seems at the moment if I launch a new debugging session via CocCommand java.debug.vimspector.start, it replaces the existing one instead of starting a new one.

Is it possible to have multiple debugging sessions at the same time?

Could not get debugger to work

Hi there,
I've been trying to get the debugger to work. But I keep running into errors. To me it looks like debug adaptor is sending requests with a wrong protocol. Logs below :-

Steps

  1. Load the project.

  2. Activate coc-debug-java plugin.

  3. Run :CocCommand java.debug.vimspector.start

  4. The splash screen opens up and says "Initializing debug adaptor" but never moves beyond it. Vim status bar (which i think shows JDT ls logs ) says "Request for initialization aborted: closing down".

  5. In the logs I see the error "Unable to start debug server"

  6. My vimspector settings :-

    {
    "adapters": {
    "java-debug-server": {
    "name": "vscode-java",
    "port": "4456"
    }
    },
    "configurations": {
    "Java Attach": {
    "adapter": "java-debug-server",
    "configuration": {
    "request": "attach",
    "host": "127.0.0.1",
    "port": "4455"
    },
    "breakpoints": {
    "exception": {
    "caught": "N",
    "uncaught": "N"
    }
    }
    }
    }
    }

Failed to attach to remote debugee VM

Good day to you!

After :CocCommand java.debug.vimspector.start received connection refused:

image

.gadgets.json:
image

.vimspector.json:
image

netstat -lnpt:
image

Any help would be great!

Thanks!

Static variables not visible in Vimspector

Describe the issue
Static variables are not shown in "Variables" view in vimspector.
In vscode-java-debug plugin there is an config option

java.debug.settings.showStaticVariables: show static variables in "Variables" viewlet, defaults to false.

I wonder if something needs to be enabled/configured in this plugin or it is not supported.

To Reproduce
Steps to reproduce the behavior:

  1. Launch debug against code which contains static vairables
  2. No static variables in "Variables" view

Expected behavior
Static variables should be visible

Versions of relevant software

  • vim: 9.1.445
  • coc.nvim: 392264f475
  • coc-java: 1.15.2
  • vimspector: latest master
  • java: 21
  • maven: -

How to do "evaluate expression"?

Hello,

One thing I really miss about IntelliJ is the evaluate expression feature when I can run arbitrary code on variables in the current stack. Could you help me figure out how to do this (or point me to documentation where I can read more about it)?

Did the .vimspector json schema change?

Getting the following error

The specified adapter 'java-debug-server' is not available. Did you forget to run 'install_gadget.py'?

My configuration is

{
  "adapters": {
    "java-debug-server": {
      "name": "vscode-java",
      "port": "${AdapterPort}"
    }
  },
  "configurations": {
    "Java Attach": {
      "adapter": "java-debug-server",
      "configuration": {
        "request": "attach",
        "host": "localhost",
        "port": "29220"
      },
      "breakpoints": {
        "exception": {
          "caught": "N",
          "uncaught": "N"
        }
      }
    }
  }
}```

coc-java-debug for tomcat7 in docker

Good day to you!

I have java spring application that runs in docker-container (tomcat7) and I want to debug it from vim.

here is my docker-compose.yml for java app :

version: '3'
services:
    java-tomcat:
        build:
            context: ../_bin/${JAVA_VERSION}
        container_name: "${CONTAINER_NAME}"
        restart: always
        volumes:
          - ${DOCUMENT_ROOT}/WAR:/usr/local/tomcat/webapps/
          - ${TOMCAT_CONF}:/usr/local/tomcat/conf/
        environment:
              ENV JPDA_ADDRESS: "8000"
              ENV JPDA_TRANSPORT: "dt_socket"
        networks: 
            - lamp
        ports:
            - 8888:8080
            - 9000:8000
        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.${CONTAINER_NAME}.rule=Host(`${CONTAINER_NAME}.docker.localhost`)"
          - "traeeik.http.routers.${CONTAINER_NAME}.entrypoints=web"

networks:
    lamp:
        external: true

my .vimspector.json:

{
  "adapters": {
    "java-debug-server": {
      "name": "vscode-java",
      "port": "${AdapterPort}"
      }
  },
  "configurations": {
    "Java Attach": {
      "adapter": "java-debug-server",
      "configuration": {
        "request": "attach",
        "host": "localhost",
        "port": "5005"
      },
      "breakpoints": {
        "exception": {
          "caught": "N",
          "uncaught": "N"
        }
      }
    }
  }
}

after container runs I'm calling
:CocCommand java.debug.vimspector.start
and
m
after that it loads hangs in 'Attaching in debugee...'
image

Before that I've had a problem with running java server and it was resolved by using answer:
neoclide/coc-java#99 (comment)

My thoughts, that I have incorrect .vimspector.json config, but at the moment can't figure out what to do.
Will appreciate any help!

Thanks!

Can't view source code

Coc-java cannot view the source code, but you can view the source code by installing a plug-in vscode-java-decompiler for vscode. Can you write a coc java decompiler plugin based on dgileadi/vscode-java-decompiler?

How start a java process with debug enabled?

Hi. first of all, let me thank you for this plugin. I tired to debug a super simple java application that contains only one file: main.java:

public class main {
    public static void main(String[] args) {
        System.out.println("foo");
        System.out.println("bar");
    }
}

So, i don't use maven or other fancy stuff. Seems in README we need maven to start a java process. Is it necessary?

First, run a Java process with debug enabled. Make sure its configured to pause and wait for a remote debugger on port 5005.
For example:
mvn test -Dmaven.surefire.debug

Stuck at Starting Java debug server..

Hi,

I followed the steps mentioned in the READMe but still unable to start the debug server.

Steps taken

  1. CocInstall coc-java
  2. Install Plugin 'puremourning/vimspector'
  3. CocInstall coc-java-debug
  4. Ran java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=28240,suspend=y Hello
  5. Open Hello.java Press F9 to start breakpoint.
  6. Ran command :CocCommand java.debug.vimspector.start

Nothing happned. When typed :messages all i see is [coc.nvim] Starting Java debug server...

Here is my :checkhealth report

health#coc#check

  • OK: Environment check passed

  • OK: Javascript bundle build/index.js found

  • OK: Service started

vim version: NVIM v0.4.3
node version: v12.13.0
coc.nvim version: 0.0.80-cc1ad56699
platform: darwin

Log of coc.nvim

2021-03-24T23:30:15.867 INFO (pid:29275) [coc-java] - Using java from /Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home, version: 11
2021-03-24T23:30:15.905 INFO (pid:29275) [plugin] - coc.nvim 0.0.80-cc1ad56699 initialized with node: v12.13.0 after 246ms
2021-03-24T23:30:15.924 INFO (pid:29275) [coc-java] - JDT Language Server starting at /Users///****/learnJava
2021-03-24T23:30:15.925 INFO (pid:29275) [services] - registered service "java"
2021-03-24T23:30:15.930 INFO (pid:29275) [language-client-index] - Language server "java" started with 29277
2021-03-24T23:30:54.196 INFO (pid:29275) [attach] - receive notification: runCommand [ 'java.debug.vimspector.start' ]
2021-03-24T23:33:44.420 INFO (pid:29275) [attach] - receive notification: runCommand [ 'java.debug.vimspector.start' ]
2021-03-24T23:35:50.498 INFO (pid:29275) [attach] - receive notification: showInfo []
2021-03-24T23:35:50.511 INFO (pid:29275) [attach] - receive request: CocAutocmd [ 'BufReadCmd', 'output', 'output:///info' ]
2021-03-24T23:44:48.065 INFO (pid:29275) [attach] - receive notification: showInfo []

Kindly help.

Readme improvements

  • Add note regarding possible slow startup times. #20
  • Illustrate roughly how it works. #3
  • Link to a full working example
  • Possibly update "adapters" config? #14
  • Add note regarding no multi-session support. #16
  • Improve profiles documentation? #7
  • Add note regarding hot code replacement. #9 #31

Getting "No project is available for evaluation" error when debugging web app using mvn jetty:run

Describe the issue
Could not evaluate variables when debugging web apps using mvnDebug jetty:run, But it is ok when using mvnDebug tomcat7:run.

To Reproduce
Steps to reproduce the behavior:

  1. Open the sample project.
  2. run mvnDebug jetty:run
  3. run "CocCommand java.debug.vimspector.start", to open the debugger
  4. Set breakpoint in the NoFoundServlet class.
  5. run curl http://localhost:8080/demo-app-1/fdsfasdfdsa
  6. Go to debug-view, try to evaluate variables,will get error: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..

In step 2, if I use mvnDebug tomcat7:run to launch, there will be no problem.
I have compared the vimspector debug log, and find nothing different between jetty:run and tomcat7:run.

Expected behavior
The variable evaluation function as expected.

Versions of relevant software

  • vim: 8.2.3455 (172)
  • coc.nvim: latest
  • coc-java: latest
  • vimspector: latest
  • java: both java8 and java11
  • maven: 3.8.1

Relevant logs and error messages

  • View the trace logging output for the Java language server:
    • Set { "java.trace.server": "verbose" } in :CocSettings.
    • Run the command :CocCommand workspace.showOutput java.
    • Are there any errors?
      !MESSAGE [error response][evaluate]: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
      !STACK 0
      com.microsoft.java.debug.core.DebugException: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
      at com.microsoft.java.debug.core.adapter.AdapterUtils.createCompletionException(AdapterUtils.java:257)
      at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:147)
      at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
      at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
      at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
      at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
      at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
      at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
      at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
      Caused by: java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json.
      at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.findJavaProjectByType(JdtEvaluationProvider.java:277)
      at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.ensureDebugTarget(JdtEvaluationProvider.java:405)
      at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:140)
      at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:115)
      at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:84)
      ... 7 more
  • View the Vimspector log :VimspectorShowOutput Vimspector.
    • Are the any errors?
  • After running the command :CocCommand java.debug.vimspector.start Do you see a message like [coc.nvim] Java debug server started on port in the output of :messages?
    Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
    Additional context
    Add any other context about the problem here.

Screenshots
If applicable, add screenshots to help explain your problem.
It is fine with tomcat7:run
2022-06-01 18 55 37
It does not work with jetty:run
2022-06-01 18 56 18
The sample project:
demo-app-1.tar.gz

Hot code replace?

Currently after the code is modified I can see Unhandled event: hotcodereplace. Is it possible to have HCR in Vim? DCEVM with auto HotSwap works but is usually very resource intensive.

Unable to set breakpoint: java.lang.IllegalArgumentException

I'm seeing Unable to set breakpoint: java.lang.IllegalArgumentException whenever I kick off a test with a break point set in one of the tests. The command I use is, mvn clean -Dmaven.surefire.debug test. The same setup works on my laptop (running slightly older arch), on my desktop I hit this issue. I'm not sure how to debug this problem. Any help please?

Below is my jdt.ls server log ,

!ENTRY java-debug 1 0 2021-03-09 16:22:29.783
!MESSAGE Trying to attach to remote debuggee VM null:5005 .

!ENTRY java-debug 1 0 2021-03-09 16:22:29.817
!MESSAGE Attaching to debuggee VM succeeded.

!ENTRY java-debug 4 0 2021-03-09 16:22:32.345
!MESSAGE [error response][setBreakpoints]: java.lang.IllegalArgumentException
!STACK 0
java.lang.IllegalArgumentException
	at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:240)
	at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:134)
	at com.microsoft.java.debug.plugin.internal.JdtSourceLookUpProvider.getFullyQualifiedName(JdtSourceLookUpProvider.java:105)
	at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.convertClientBreakpointsToDebugger(SetBreakpointsRequestHandler.java:277)
	at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.handle(SetBreakpointsRequestHandler.java:125)
	at com.microsoft.java.debug.core.adapter.DebugAdapter.lambda$dispatchRequest$0(DebugAdapter.java:87)
	at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
	at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
	at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:86)
	at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:118)
	at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$new$0(AbstractProtocolServer.java:78)
	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:60)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:200)
	at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252)
	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

!ENTRY java-debug 1 0 2021-03-09 16:50:13.409
!MESSAGE Debug connection closed

can it support neovim

Hi,I am a java programmer.can it run in neovim? I run CocCommand java.debug.vimspector.start,but the report is wrong: The specified adapter'java-debug-server' is not available. but I installed coc-java and vimspector.It has othertings to do ?
Think you ,very much!

Vimspector doesnt stop at breakpoints

I followed the exact steps on readme.md. I put some breakpoints and then when i connect to the remote host it just runs the code without stopping.
here is my .vimspector.json:
`
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"default": true,
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "127.0.0.1",
"port": "5005"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}

`
EDIT: I got it to work on maven project, But still cant cofigure it on a stand alone file.

can not get variable evalution work for single class program

Describe the issue
can not get evalution work when debuging single class program without maven or gradel support.

I found this in vscode doc

projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. It is required when the workspace has multiple Java projects, otherwise the expression evaluation and conditional breakpoint may not work.

and this in vscode-java-debug repo

projectName - The preferred project in which the debugger searches for classes. It's required for the evaluation feature. Most of the time, the debugger will auto generate the configuration for you. In case you want to manually configure it, here are the rules.

When you open a maven project, the project name is the artifactId.
When you open a gradle project, the project name is the baseName or the root folder name.
When you open other Java files, leave the launch.json empty and allow the debugger auto generates the project name for you.
Pro Tip: The easiest way to get the project name is to install Java Dependency Viewer extension, the top node in the JAVA DEPENDENCIES view is your project name.

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

  1. write a single class program
  2. start it with remote debugging enabled
  3. attatch to it using vimspector without "projectName" besing set
  4. step debug works fine and left top window shows some variables, but evaluate variable in left middle watches window results error " *- Result: Cannot evaluate because of java.lang.IllegalStateException: Project leetcode cannot be found.."

Expected behavior
able to watch expression. maybe get the ${projectName) like ${adapterPort}.

Versions of relevant software

Relevant logs and error messages

  • View the trace logging output for the Java language server:

[Error - 11:04:18 PM] May 5, 2022, 11:04:18 PM [error response][evaluate]: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
com.microsoft.java.debug.core.DebugException: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
at com.microsoft.java.debug.core.adapter.AdapterUtils.createCompletionException(AdapterUtils.java:246)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:147)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json.
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.findJavaProjectByType(JdtEvaluationProvider.java:277)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.ensureDebugTarget(JdtEvaluationProvider.java:405)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:140)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:115)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:84)
... 7 more

  • After running the command :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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.