Giter VIP home page Giter VIP logo

Comments (19)

yyoncho avatar yyoncho commented on May 19, 2024

Error from the Language Server: No delegateCommandHandler for vscode.java.startDebugSession (Method not Found)

This means that the debug plugin/bundle is missing.

what does C-: (lsp-java--bundles) returns? Did you try to delete lsp-java-server-install-dir and then call lsp-java-update-server?

Also, inspect the messages buffer when lsp-java is starting, ussually there is an error message if JDT LS fails to load a bundle.

Can you make sure that you are using latest version of dap-mode and you are not hitting #30 ?

from dap-mode.

skybert avatar skybert commented on May 19, 2024

This means that the debug plugin/bundle is missing.

I believe I've encountered that one before. Mhmm. Do I have to do anything extra to get that bundle?

what does C-: (lsp-java--bundles) returns

("/home/torstein/.emacs.d/eclipse.jdt.ls/server/bundles/java.debug.plugin.jar")

Did you try to delete lsp-java-server-install-dir and then call lsp-java-update-server?

Tried that (again), but although *Messages* look good:

10-Jan-2019 15:03:54 Initializing Java Language Server 0.30.0.201812180348
10-Jan-2019 15:03:54 Installed reference:file:/home/torstein/.emacs.d/eclipse.jdt.ls/server/bundles/java.debug.plugin.jar
Init...[Starting]
0% Starting Java Language Server [Starting]
10-Jan-2019 15:03:54 Started reference:file:/home/torstein/.emacs.d/eclipse.jdt.ls/server/bundles/java.debug.plugin.jar
10-Jan-2019 15:03:54 >> initialized
20% Starting Java Language Server [Starting]

I still get:

10-Jan-2019 15:05:01 >> workspace/executeCommand vscode.java.startDebugSession
Error from the Language Server: No delegateCommandHandler for vscode.java.startDebugSession (Method not Found)
open-network-stream: Wrong type argument: stringp, nil

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

Hm, when you do lsp-describe-session and when you expand the jdtls capabilities do you see vscode.java.startDebugSession in the list of commands?

 `-[-] jdtls:5034
    |-[-] Buffers
    |  |-[+] Importer.java
    |  `-[+] ImporterIntegrationTest.java
    `-[-] Capabilities
       |-[-] workspace:
       |  `-[-] workspaceFolders:
       |     |-[X] changeNotifications: t
       |     `-[X] supported: t
       |-[-] executeCommandProvider:
       |  `-[X] commands: (che.jdt.ls.extension.findImplementers vscode.java.fetchUsageData che.jdt.ls.extension.detectTest che.jdt.ls.extension.libraryChildren che.jdt.ls.extension.findTestByCursor che.jdt.ls.extension.findTestFromProject che.jdt.ls.extension.effectivePom che.jdt.ls.extension.mavenProjects che.jdt.ls.extension.externalLibrariesChildren che.jdt.ls.extension.libraryEntry che.jdt.ls.extension.debug.findResourcesByFqn vscode.java.resolveMainClass che.jdt.ls.extension.usages che.jdt.ls.extension.reImportMavenProject che.jdt.ls.extension.plain.createProject che.jdt.ls.extension.refactoring.rename.validate.new.name che.jdt.ls.extension.outputDir org.eclipse.che.jdt.ls.extension.filestructure vscode.java.buildWorkspace che.jdt.ls.extension.import.organizeImports java.project.listSourcePaths che.jdt.ls.extension.refactoring.move.validate che.jdt.ls.extension.refactoring.move.command vscode.java.resolveClasspath che.jdt.ls.extension.plain.getProjectSourceLocations java.project.updateSourceAttachment che.jdt.ls.extension.configuration.updatePreferences che.jdt.ls.extension.refactoring.move.verify.destination che.jdt.ls.extension.findTestFromEntry che.jdt.ls.extension.externalLibraries che.jdt.ls.extension.classpathTree che.jdt.ls.extension.plain.sourceFolders java.project.resolveSourceAttachment vscode.java.startDebugSession che.jdt.ls.extension.plain.updateClasspath java.project.addToSourcePath che.jdt.ls.extension.pom.diagnostics che.jdt.ls.extension.updateWorkspace che.jdt.ls.extension.libraryContentURL che.jdt.ls.extension.resolveClasspath che.jdt.ls.extension.findTestInFile che.jdt.ls.extension.refactoring.move.get.destinations.command che.jdt.ls.extension.configuration.updateJavaCoreOptions che.jdt.ls.extension.refactoring.rename.get.linked.elements che.jdt.ls.extension.findTestFromFolder java.edit.organizeImports java.project.removeFromSourcePath che.jdt.ls.extension.refactoring.rename che.jdt.ls.extension.configuration.getPreferences che.jdt.ls.extension.refactoring.rename.get.type che.jdt.ls.extension.plain.addJarsToClassPath che.jdt.ls.extension.libraryContentByPath che.jdt.ls.extension.configuration.getJavaCoreOptions vscode.java.updateDebugSettings che.jdt.ls.extension.debug.identifyFqnInResource)
       |-[-] renameProvider:
       |  `-[X] prepareProvider: t
       |-[-] documentOnTypeFormattingProvider:
       |  |-[X] moreTriggerCharacter: (

from dap-mode.

skybert avatar skybert commented on May 19, 2024

Mhmm. I cannot expand anything, it just says:

[X] ~/src/my-project

and that's it.

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

Hm, this is odd.

There is dap-mode test that covers this functionality (attaching to remote target) and at this point it is green.

Clone the repo and install cask:

cask install
cask exec ecukes --timeout 60 features/JUnit.feature

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

I was about to setup a new debian machine for testing and I hit the exactly the same issue - it is caused by using OpenJDK - after I switched to Oracle version the issue was fixed.

from dap-mode.

skybert avatar skybert commented on May 19, 2024

Thanks for figuring out that one.

So is this a bug or a missing feature? lsp-java works with OpenJDK, so IMHO dap-mode should too. But this has perhaps nothing to do with dap-mode itself, but the debug plugin to the Eclipse server?

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

It is something related to JDT LS/Che JDT LS/Java Debug Adapter/OpenJDK version. You may run

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

Is this still relevant?

from dap-mode.

skybert avatar skybert commented on May 19, 2024

I'll change my config to use OpenJDK 11 and use it for a day. Then I'll report back.

from dap-mode.

skybert avatar skybert commented on May 19, 2024

I haven't encountered this again when running on OpenJDK 11, no. Admittedly I only debug JUnit tests, but if they both call vscode.java.startDebugSession, it should be safe to assume the issue has been resolved?

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

I think so.

Offtopic: As a side note, I think that you are going to take part of Emacs conf? If this is so and if you are going to present lsp-java/dap-mode I will be happy to provide feedback on your agenda and eventually solve issues that bother you.

from dap-mode.

skybert avatar skybert commented on May 19, 2024

Hi @yyoncho,

yes, I will do a wee presentation at Emacs Conf (10 min). In the demo I've prepared I plan to show:

Code navigation

Works.

Jump to source of 3rd party libraries

Works.

Auto completion

Works.

Import classes

Works.

Static import methods and fields

Works well for single imports, replacing the current one, but I don't
dare to use the replace all function as this sometimes deletes code
it shouldn't.

Not a big issue for my demo, though, just FYI.

Run JUnit tests from within Emacs

Works.

Linting

  • Unused variables
  • Wrong syntax
  • Missing generics

Works.

Implement missing class

Works, but I will not show it because lsp-java often has problems
recognising that the class is indeed present. Often (always?) I must
do a mvn clean install on the project for the new class to work
everywhere. Reloading the file revert-buffer also makes lsp-java
recognise the new class (but I believe dap still will fail).

Interestingly, code navigation to the new class works just
fine. Still, both the linting and dap-mode fails because it "doesn't exist".

The behaviour is easy enough to reproduce (at least for me, using my
.emacs) using the branch feature/empty-shop here:
https://gitlab.com/skybert/cheese-shop/tree/feature/empty-shop/
My .emacs is here: https://gitlab.com/skybert/my-little-friends/blob/master/emacs/.emacs

In CheeseShop, add Customer customer = new Customer() and then
have lsp-java create Customer for you. You can navigate to
Customer from CheeseShop, but flycheck will mark Customer as
undefined and dap-java-run-test-class will fail.

Implement missing method

Works.

Debug application from within Emacs

Works.

Debugger with conditional break points

Works. (one of my favourite features in dap-mode)

Refactoring: rename variable

Works, but has sometimes the same problem as Implement missing class, code navigation to the new method name works, but the classes
using the method on the object mark it as undefined.

Other things

In addition comes things that aren't lsp-java/dap-mode specifc, but helps create an awesome java development environment in Emacs.

What do you think?

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

I think that some of the issues that you are seeing are caused either by dap not doing a build before running something(which is a bug that I should fix) or caused by the fact you have disabled file watches. I believe some of them could be fixed with lsp-java-build-project which you should call from time to time when the watches are disabled.

Refactorings: I think you could demo inline/extract method/variable(my favourites).

You may include lsp-treemacs stuff like: https://github.com/emacs-lsp/lsp-treemacs#lsp-treemacs-deps-list

There is a lot of stuff to demo though, 10 minutes wouldn't be enough.

  1. dap-ui-repl
  2. dap-hydra
  3. spring boot support
  4. XML language server is great for editing pom.xml

but I don't dare to use the replace all function as this sometimes deletes code
it shouldn't.

When you hit issues like these, please go ahead and report them. I think most of them are JDT LS issues and they are very responsive. You may be hitting: eclipse-jdtls/eclipse.jdt.ls#1203

FYI I am working on support of java test extension:
Screenshot at 2019-10-22 22-49-51

from dap-mode.

skybert avatar skybert commented on May 19, 2024

I think that some of the issues that you are seeing are caused either by dap not doing a build before running something(which is a bug that I should fix) or caused by the fact you have disabled file watches.

I've enabled lsp-enable-file-watchers t, but the problem of not recognising newly created classes persists.

I didn't think of tryinglsp-java-build-project as this always fails on my "real" projects. In cheese-shop it works, but not for newly created interface (I introduced Customer extends Visitor and had lsp create Visitor for me.

inline/extract method/variable

These are really nice! I definitely want to include those.

I didn't discover them because they don't show up until you've selected the region. For extract to method, I understand that you want the user to have selected the region, but for extract to variable, it should IMO work when you're just on the same line:

|foo.getList();

where extract to variable gives:

Foo foo2 = foo;
foo2.getList();

Which isn't useful to me. What I'd expect (the way IDEA works):

Foo foo = foo.getList();

You may include lsp-treemacs stuff

Good idea. I've included the deps browser, the symbols browser and the error browser in my demo.

It looks grand. Is there a way to scale the icons according to text height? They're a bit too big in my setup:

(set-face-attribute 'default nil
                            :family "Source Code Pro"
                            :height 100
                            :weight 'normal
                            :width 'normal)

When you hit issues like these, please go ahead and report them.

Thanks for the reminder.

FYI I am working on support of java test extension:

So cool!

Talking about tests. Is there away to use the JUnit 4 test runner and not JUnit5/Vintage for Junit4 tests? dap can't run any of the tests in a couple of my projects with both 4 and 5 on the classpath.

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

I didn't think of tryinglsp-java-build-project as this always fails on my "real" projects. In cheese-shop it works, but not for newly created interface (I introduced Customer extends Visitor and had lsp create Visitor for me.

I will try it on my side.

|foo.getList();

Place the cursor on ; and you will endup with what you want. But yeah, still I consider this as a bug of JDT LS, havent reported it yet to the server(e. g. it should extract even when you are on List.

When you hit issues like these, please go ahead and report them.
Thanks for the reminder.

To elaborate a bit more - everything that does not work flawlessly should be reported. I am not con

It looks grand. Is there a way to scale the icons according to text height? They're a bit too big in my setup:

I use

  (add-hook 'treemacs-mode-hook
            (lambda () (treemacs-resize-icons 15)))

Talking about tests. Is there away to use the JUnit 4 test runner and not JUnit5/Vintage for Junit4 tests? dap can't run any of the tests in a couple of my projects with both 4 and 5 on the classpath.

The new test runner I am writing now will distinguish junit 4/5/testng and it will solve that issue. But still, IMO we should solve the issue for the current runner(e. g. report it upstream or introduce separate command for junit4/junit5 on our side). We should start with a but report on our side.

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

In cheese-shop it works, but not for newly created interface (I introduced Customer extends Visitor and had lsp create Visitor for me.

I tested on my side and I was unable to reproduce it. Do you do save all files after you create the new class? I think that if you call mvn clean install you save the files and the issue goes away not because of the mvn invocation but because of saving the project file before compilation.

from dap-mode.

skybert avatar skybert commented on May 19, 2024

Heya,

sorry for the late reply.

To elaborate a bit more - everything that does not work flawlessly should be reported. I am not con

I like your attitude.

treemacs-resize-icons 15

Thanks, that looks a bit better. Still think some icons (the one with white background for java files and the yellow for warnings) are a tad too cartoonish, but I guess that's what icon themes are for 😄

Place the cursor on ; and you will endup with what you want.

Thanks for the tip. That works.

Do you do save all files after you create the new class?

Yes, that seems (so far) to solve all my problems with new classes and interfaces. It's much smoother now that I know this caveat.

from dap-mode.

yyoncho avatar yyoncho commented on May 19, 2024

Thanks, that looks a bit better. Still think some icons (the one with white background for java files and the yellow for warnings) are a tad too cartoonish, but I guess that's what icon themes are for

Yes - I have used the icons from vscode - we will do all-the-icons theme one day - emacs-lsp/lsp-treemacs#18

Yes, that seems (so far) to solve all my problems with new classes and interfaces. It's much smoother now that I know this caveat.

Good.

from dap-mode.

Related Issues (20)

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.