3

I have a VS Code extension for ST language support. Right now it provides only syntax highlights and some snippets. I wanted to create a tree structure of the document showing programs, functions and their parameters in the Outline panel. But I cannot find an example of how to do that.

Can you refer me to the right direction but not to LSP as it is too complicated for now I want to make it programmatically.

Gama11
  • 31,714
  • 9
  • 78
  • 100
Sergey Romanov
  • 2,949
  • 4
  • 23
  • 38

1 Answers1

4

The outline view is populated by a DocumentSymbolProvider (see also: registerDocumentSymbolProvider()). In the language server protocol, this corresponds to the textDocument/documentSymbol request.

All in all, it currently provides the data for all of these:

  • Outline view
  • Breadcrumbs
  • Go to Symbol in File

You can find an example implementation of one here, though you'll want it to return DocumentSymbol rather than SymbolInformation instances. Only the former supports the hierarchy needed for the outline view via it's children property.

Gama11
  • 31,714
  • 9
  • 78
  • 100