Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

GH-858: [LS] Added support for the hierarchical document symbols. #862

Merged
merged 1 commit into from
Sep 25, 2018

Conversation

kittaakos
Copy link
Member

Closes: eclipse/xtext-eclipse#858.

Signed-off-by: Akos Kitta [email protected]

@cdietrich cdietrich requested a review from spoenemann September 6, 2018 13:05
@cdietrich cdietrich added this to the Release_2.16 milestone Sep 6, 2018
@ImplementedBy(Noop)
interface IDocumentSymbolService {

def List<Either<SymbolInformation, DocumentSymbol>> getSymbols(Document document, XtextResource resource,
Copy link
Member

Choose a reason for hiding this comment

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

this is one of the apis where i am not sure if i like it. e.g. this could not be used to produce an eclipse outline without using lsp4j

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not against modifying, adjusting it, but I would like to understand what is wrong with the lsp4j model API? If I understood you correctly, you would like to introduce another API in xtext-core that would be used by xtext-eclipse and will be transformed into the IOutlineNode, right? But xtext-eclipse already has lsp4j as a dependency, right? Then why to add another API?

Copy link
Member

Choose a reason for hiding this comment

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

no it does not thats the point

Copy link
Member

Choose a reason for hiding this comment

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

=> for api that might be useful toi be reused in eclipse it might help to have a lsp4j independent api e.g. as we do it for content assist

Copy link
Member

Choose a reason for hiding this comment

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

=> we should decide that at per api level if it can be usefully used in more than the lsp4j context. currently we are inconsistent with that cc @tivervac

Copy link
Member

Choose a reason for hiding this comment

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

i can live with that if we dont offer this as api to be used in eclipse

Copy link
Member

Choose a reason for hiding this comment

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

Ok

Copy link
Member Author

Choose a reason for hiding this comment

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

i can live with that if we dont offer this as api to be used in eclipse

Should I remove the @since 2.16 from the source? How should we proceed with this PR?

Although the PR is not super urgent, I would like to get this done if you do not have any objections. Thanks!

One thing that we have to keep in mind before we merge is the LSP4J API. See here eclipse-lsp4j/lsp4j#252.

Copy link
Member

Choose a reason for hiding this comment

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

we marked provisional api as @Beta before. correct @szarnekow @svenefftinge ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we did that in some places.

val rootSymbols = newArrayList;
val itr = getAllContents(resource);
while (itr.hasNext) {
operationCanceledManager.checkCanceled(cancelIndicator);
Copy link
Member

Choose a reason for hiding this comment

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

i wonder if we can build a lsp4j independent tree and transform it to a lsp4j conformant later on

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, we can do this but let's move this conversation to here. I think they are related.

@spoenemann spoenemann removed their request for review September 14, 2018 07:12
@@ -75,6 +75,12 @@ class DocumentExtensions {
return resource.newLocation(textRegion)
}

def Location newFullLocation(EObject object) {
Copy link

Choose a reason for hiding this comment

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

missing @since 2.16 here

@@ -406,6 +408,22 @@ import static org.eclipse.xtext.diagnostics.Severity.*
]
}

protected def IDocumentSymbolService getIDocumentSymbolService(IResourceServiceProvider serviceProvider) {
Copy link

Choose a reason for hiding this comment

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

also add @since for new protected methods in public API packages

@@ -31,11 +33,11 @@ public void setExpectedSymbols(final String expectedSymbols) {
}

@Pure
public Procedure1<? super List<? extends SymbolInformation>> getAssertSymbols() {
public Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> getAssertSymbols() {
Copy link

Choose a reason for hiding this comment

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

add @since

return this.assertSymbols;
}

public void setAssertSymbols(final Procedure1<? super List<? extends SymbolInformation>> assertSymbols) {
public void setAssertSymbols(final Procedure1<? super List<Either<SymbolInformation, DocumentSymbol>>> assertSymbols) {
Copy link

Choose a reason for hiding this comment

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

add @since

@kittaakos
Copy link
Member Author

Thanks for the feedback on this PR. One general question, shall we use @Beta or @since. Thanks!

@kthoms
Copy link

kthoms commented Sep 19, 2018

I'd say a class once made public available can't be @Beta, and adding API methods can't either. And if I see this correctly, @Beta is only used on type level in the codebase.

So adding API methods to API classes can't be beta, thus we have to be carefully.

@cdietrich
Copy link
Member

No Beta says available but not API

@@ -682,7 +702,7 @@ class DocumentHighlightConfiguration extends TextDocumentPositionConfiguration {
@Accessors
class DocumentSymbolConfiguraiton extends TextDocumentConfiguration {
Copy link

Choose a reason for hiding this comment

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

Typo in class name :(

@cdietrich
Copy link
Member

The main problem is that the whole of lsp and how ms deals with it and how Java works vs typescript works in incompatible with eclipse api rules. So marking as beta can give users a hint on that

@kittaakos
Copy link
Member Author

So marking as beta can give users a hint on that

👍

Can we agree that I should get rid of @since and use @Beta instead?

@kthoms
Copy link

kthoms commented Sep 19, 2018

So API rule incompatibility is blocking this change? If so, please veto @cdietrich .

@cdietrich
Copy link
Member

No it’s new code. Simply mark it as beta

@kittaakos
Copy link
Member Author

No it’s new code. Simply mark it as beta

This.

Thanks, guys! I apply the changes soon.

@kittaakos
Copy link
Member Author

I made the changes.

@kittaakos
Copy link
Member Author

Can someone please look into (or restart) the build, I do not have problems running it locally:

git rev-parse --short HEAD && git clean -fxdq && ./gradlew -q clean build
65b1f89a6
Note: Some input files use or override a deprecated API.
...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Akoss-MacBook-Pro:xtext-core akos.kitta$ 

Thank you!

@kittaakos
Copy link
Member Author

If this PR is good to merge, please push the button. Thank you!

@svenefftinge svenefftinge merged commit 9e46f30 into eclipse:master Sep 25, 2018
@kittaakos kittaakos deleted the GH-858 branch September 25, 2018 12:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants