Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only return jdt:// urls if clients support it #649

Closed
GordianDziwis opened this issue May 3, 2018 · 7 comments
Closed

Only return jdt:// urls if clients support it #649

GordianDziwis opened this issue May 3, 2018 · 7 comments
Assignees
Milestone

Comments

@GordianDziwis
Copy link

GordianDziwis commented May 3, 2018

The language server returns links based on the jdt protocol instead a filepath jdt://contents/slf4j-api-1.7.10.jar/org.slf4j/ILoggerFactory.class?=linkedgeodata-core/%5C/home%5C/some%5C/.m2%5C/repository%5C/org%5C/slf4j%5C/slf4j-api%5C/1.7.10%5C/slf4j-api-1.7.10.jar%3Corg.slf4j%28ILoggerFactory.class#38

Neovim can not handle those, is it possible to configure the server in a way, that a filepath is returned?

See Uris like jdt://... not supported · Issue #392 · autozimu/LanguageClient-neovim

@fbricon
Copy link
Contributor

fbricon commented May 3, 2018

Not really. Those links are for class files inside jar files. So returning a file path makes no sense.
The best thing I can think of is add a capability flag, sent from the client, which, if set to false, would not return those jdt:// URIs at all, effectively killing the navigation to class files

@GordianDziwis
Copy link
Author

And with this function it would be possible to retrieve the source.
But this is an extension to LSP and java specific?

@fbricon
Copy link
Contributor

fbricon commented May 3, 2018

yes, but it needs the client to send jdt based uris

@fbricon fbricon changed the title Browsing external dependencies with LanguageClient-neovim Only return jdt:// urls if clients support it May 3, 2018
@fbricon fbricon self-assigned this May 3, 2018
@fbricon fbricon added this to the Mid May 2018 milestone May 3, 2018
@fbricon
Copy link
Contributor

fbricon commented May 3, 2018

All search scopes need to be changed so that

int scope = IJavaSearchScope.SOURCES;
if (classFileContentSupported) {
	scope |= IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES;
}

@GordianDziwis
Copy link
Author

It is possible to unpack the dependencies with maven:

mvn dependency:unpack-dependencies
  -Dclassifier=sources
  -Dmdep.failOnMissingClassifierArtifact=false

Could a client use these for browsing the sources?

@fbricon
Copy link
Contributor

fbricon commented May 4, 2018

That won't work. The server maps the binary jars to their matching source jars automatically. There's no way to map sources to a different folder server-side. Even if we added a way to do it, neovim would still have to do some custom development to call that new mechanism. So however we do it, it won't work OOTB for any client.

@fbricon
Copy link
Contributor

fbricon commented May 9, 2018

FTR, clients will need to advertise their support by passing extendedClientCapabilities.classFileContentsSupport=true in initializationOptions, as in

    "initializationOptions": {
        "bundles": [...],
        "workspaceFolders": [...],
        "settings": {...},
        "extendedClientCapabilities": {
            "classFileContentsSupport": true
        }
    },

cc @brookhong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants