eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.
https://eclipse.org/lsp4j
Other
599 stars 143 forks source link

Deprecated SymbolInformation and impact on documentSymbol #697

Closed carueda closed 1 year ago

carueda commented 1 year ago

Hello lsp4j team:

Related: https://github.com/eclipse/lsp4j/issues/252

A language server of mine does not use SymbolInformation directly at all, but it does use CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(DocumentSymbolParams).

It would be great if there's a way to avoid the related compile warnings caused by deprecated SymbolInformation.

(In my projects I usually instruct my compiler to treat compile warnings as errors--but that's just a personal preference.)

In my particular (>23K LOC) project the only warnings are happening in my overridden documentSymbol method.

I'm aware of the backwards-compatibility considerations, etc., and don't have really definitive suggestions to address this, but can think of perhaps lsp4j also offering an alternative "documentSymbol2" (or some other name/suffix) method only involving DocumentSymbol:

@JsonRequest
@ResponseJsonAdapter(DocumentSymbolResponseAdapter.class)
default CompletableFuture<List<DocumentSymbol>> documentSymbol2(DocumentSymbolParams params) {
   throw new UnsupportedOperationException();
}

But there are probably other possible ways.

Thanks for considering.

jonahgraham commented 1 year ago

What about removing the class level @Deprecated, but leave a comment and make the fields deprecated. That way any "real" use of the class would generate warnings, but simply using the documentSymbol method would not.

WDYT?

carueda commented 1 year ago

That would work, thanks!

jonahgraham commented 1 year ago

@carueda the change has been made. The 0.21.0-SNAPSHOT version should be automatically built and published in a few minutes.