question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can jdt.ls jump to definitions in third party libraries

See original GitHub issue

For example

import org.springframework.context.annotation.Configuration;

Can jdt.ls be used to jump to the definition of that class ?

I am using the YouCompleteMe client and working in a gradle project.

There may be some mistake in my client configuration. Before diving into that, I wanted to make sure the server side is capable for that.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mfusseneggercommented, Mar 15, 2020

Can jdt.ls be used to jump to the definition of that class ?

The server supports to jump to class files. But it is an extension and not part of the LSP standard.

To opt-in for this extension, the initialization options have to be extended:

extendedClientCapabilities = {
            classFileContentsSupport = true
        }

Once that is set, the client will start to receive Location items that have a jdt://... uri as response to textDocument/definition, textDocument/references and so on. This needs to be handled in a special way by the client.

Here is an example of how I customized the neovim built-in LSP client to do that.

0reactions
john-ptcommented, Apr 19, 2020

@ahakanbaba Hello, I was wondering if you were able to add this initialization option into YouCompleteMe configuration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Valloric/YouCompleteMe - Gitter
Do you know can jdt.ls jump to definition for types defined in third party libraries or in utils.Java ? You're looking for :YcmCompleter...
Read more >
Eclipse JDT: how to get data model for Java content assist
It seems that the only option is to create a (temporary) compilation unit, which in turn requires a properly set up Java project....
Read more >
mfussenegger/nvim-jdtls: Extensions for the built-in LSP support in ...
Install eclipse.jdt.ls by following their Installation instructions. ... These are necessary to load source code from third party libraries or the JDK.
Read more >
Language Support for Java(TM) by Red Hat
The path to the Java Development Kit can be specified by the java.jdt.ls.java.home setting in VS Code settings (workspace/user settings).
Read more >
LSP Java
LSP Java does not provide completion, go to definition for some of the files? When particular file is not part of imported project...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found