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

Protocol extension for 'implementors' #379

Closed
wants to merge 1 commit into from

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Oct 9, 2017

Fixes #362

Signed-off-by: Snjezana Peco snjezana.peco@redhat.com

Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
*
*/
@JsonRequest(value = "java/implementors", useSegment = false)
CompletableFuture<List<? extends SymbolInformation>> implementors(TextDocumentPositionParams position);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need something more open for the parameter, eg. what if the request only contains an FCQN? I think we should have only 1 java/implementors entry point, but the incoming parameter should probably wrap TextDocumentPositionParams and some other stuff. Shooting from the hip:

ImplementorRequestParams {
   - query {
          - fullyQualifiedName: String (optional)
   or   - position : TextDocumentPositionParams (optional) 
   }
   - options : Map<String, String> (optional)
}

We need more info from @tsmaeder about potential usage of that API in Che.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call it java/typeHierarchy instead?

private List<SymbolInformation> findImplementations(IType type, IProgressMonitor monitor) throws JavaModelException {
IType[] results = type.newTypeHierarchy(monitor).getAllSubtypes(type);
final List<SymbolInformation> symbols = new ArrayList<>();
for (IType t : results) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return empty list if monitor is cancelled

si.setName(name == null ? t.getElementName() : name);
si.setKind(t.isInterface() ? SymbolKind.Interface : SymbolKind.Class);
if (t.getParent() != null) {
si.setContainerName(t.getParent().getElementName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does t.getParent().getElementName() return a fcqn or simple name? We need to guarantee unambiguous parent hierarchy

@fbricon
Copy link
Contributor

fbricon commented Oct 10, 2017

@snjeza I think there's room for refactoring the existing codelens handler returning references here

Copy link
Contributor

@fbricon fbricon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to eclipse-che/che#6157 (comment), for request options, typically we need to have at least 2 params:

  • supertypes : boolean
  • subtypes : boolean (true by default)

@snjeza
Copy link
Contributor Author

snjeza commented Oct 10, 2017

According to eclipse-che/che#6157 (comment), for request options, typically we need to have at least 2 params:

Please see #362 (comment)

@fbricon
Copy link
Contributor

fbricon commented Oct 10, 2017

I think the requirement in #362 is incomplete, eclipse-che/che#6157 provides more info on what we should expect

@snjeza
Copy link
Contributor Author

snjeza commented Oct 10, 2017

@tsmaeder Could you, please, complete your request?

@fbricon
Copy link
Contributor

fbricon commented Oct 18, 2017

Abandoned in favour of a jdt.ls extension on the Che side: eclipse-che/che#6736

@fbricon fbricon closed this Oct 18, 2017
@egamma
Copy link

egamma commented Oct 18, 2017

@tsmaeder @fbricon this is cool, but now that LSP supports protocol extensions it would be even cooler to have this as a protocol extension:

  • add an Implementor protocol extension
  • the eclipse.jdt.ls provides the protocol extension
  • EclipseChe negotiates whether the protocol extension and exposes the feature.

In this way both the LSP and other consumers of the eclipse.jdt.ls language server profit from this support.

//CC @dbaeumer @aeschli

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

Successfully merging this pull request may close these issues.

4 participants