-
Notifications
You must be signed in to change notification settings - Fork 96
GH-858: [LS] Added support for the hierarchical document symbols. #862
Conversation
@ImplementedBy(Noop) | ||
interface IDocumentSymbolService { | ||
|
||
def List<Either<SymbolInformation, DocumentSymbol>> getSymbols(Document document, XtextResource resource, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@@ -75,6 +75,12 @@ class DocumentExtensions { | |||
return resource.newLocation(textRegion) | |||
} | |||
|
|||
def Location newFullLocation(EObject object) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add @since
I'd say a class once made public available can't be So adding API methods to API classes can't be beta, thus we have to be carefully. |
No Beta says available but not API |
@@ -682,7 +702,7 @@ class DocumentHighlightConfiguration extends TextDocumentPositionConfiguration { | |||
@Accessors | |||
class DocumentSymbolConfiguraiton extends TextDocumentConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in class name :(
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 |
👍 Can we agree that I should get rid of |
So API rule incompatibility is blocking this change? If so, please veto @cdietrich . |
No it’s new code. Simply mark it as beta |
This. Thanks, guys! I apply the changes soon. |
Closes: eclipse#858. Signed-off-by: Akos Kitta <[email protected]>
I made the changes. |
Can someone please look into (or restart) the build, I do not have problems running it locally:
Thank you! |
If this PR is good to merge, please push the button. Thank you! |
Closes: eclipse/xtext-eclipse#858.
Signed-off-by: Akos Kitta [email protected]