eclipselabs/eclipse-language-service

support open symbols

Closed this issue · 5 comments

Support open symbols

I prepared PR with initial and basic implementation for finding symbols in file (#62). If someone will be interested I can update this PR to be more ready to merge :)

Thanks @mniewrzal for your PR. I would like just give you an idea that I have implemented in typescript.java to support both :

  • outline
  • quick outline.

My idea is:

  • outline and quick outline shares the same model (in your case list of SymbolInformation). In other words outline loads a model and after the quick outline uses the loaded model.
  • outline + quick outline shares the same label+content ptovider

See https://github.com/angelozerr/typescript.java/tree/master/eclipse/ts.eclipse.ide.ui/src/ts/eclipse/ide/ui/outline

This idea gives you the capability:

  • to avoid loading model each time quick outline is opened (in the case of the user doesn't change content of the editor)
  • share label + content provider and share the same behaviours (same renderer, same icons, same code to select a selected symbol, etc)

Hi @angelozerr , thanks for comments. As I wrote its just basic implementation to utilize LSP symbols and I just tried to reflect how vscode is doing this.

If this feature should go into direction of classic outline then I think it would be nice to have minimal infrastructure for outline and quick outline in generic editor. From what I see in your type script plugins you wrote most of things by yourself. This is a little bit annoying because every project is writing own version for something very common :)

I will try to prepare quick outline version at the beginning to see how it can be integrated with LSP support.

@mniewrzal totally agree with you!

I have created a bug at https://bugs.eclipse.org/bugs/show_bug.cgi?id=506737

I've also added a change which shows symbols in outline. It's using the CNF framework to contribute the symbols. I believe there are great opportunities for factorization between the pop-up and outline, by reusing CNF.
Would also be great to have the pop-up mapped to a quick outline command on Ctrl+O.