Skip to content Skip to sidebar Skip to footer

Language Server Protocol: Get Symbol Information Of Inner Functions/classes

What I want I'm searching for a command in VSCode (a la vscode.commands.executeCommand(...)) that returns symbol information (outline) of inner functions/classes of a function/clas

Solution 1:

There's no API like that. Language support is self contained and usually does not provide its information to the outer world.

You would instead have to create your own parser, which processes the code to find symbol information.

Solution 2:

This information is hidden inside the children property of DocumentSymbol (returned by vscode.executeDocumentSymbolProvider):

let symbols = vscode.commands.executeCommand ('vscode.executeDocumentSymbolProvider');

console.log (symbols[0].children); 

I write 'hidden' because children does not show, if you simply run console.log (symbols); in the above code.

Post a Comment for "Language Server Protocol: Get Symbol Information Of Inner Functions/classes"