vscode-code-outline
vscode-code-outline copied to clipboard
regression: java symbols no longer displayed as a tree
With vscode-java/jdt.ls, a textDocument/documentSymbol
call returns something like:
[Trace - 12:48:07] Received response 'textDocument/documentSymbol - (33)' in 6ms.
Result: [
{
"name": "main(String[])",
"kind": 6,
"location": {
"uri": "file:///Users/fbricon/Desktop/Standalone.java",
"range": {
"start": {
"line": 12,
"character": 20
},
"end": {
"line": 12,
"character": 24
}
}
},
"containerName": "Standalone"
},
{
"name": "Standalone",
"kind": 5,
"location": {
"uri": "file:///Users/fbricon/Desktop/Standalone.java",
"range": {
"start": {
"line": 10,
"character": 13
},
"end": {
"line": 10,
"character": 23
}
}
},
"containerName": "Standalone.java"
}
]
vscode-code-outline displays the main
method at the root of the tree, same level as Standalone
, instead of nesting it under Standalone
. My guess is the latest algorithm gets confused by the root node having a containerName (Standalone.java
) instead of a blank value.
This used to work a while ago:
This library relies on location
rather than containerName
as there was no way to have it work correctly based on container names (there can be multiple objects with the same name).
@patrys Patryk, what's expected format of json to get working outline tree, please? It looks like we are facing the same flat structure in our language server output...
@patrys can you explain how the location is used to build the tree? Looking at the output for an html content, it's definitely not obvious.