Summary
The LSP server's textDocument/documentSymbol response returns a fully populated symbol tree for requirements.yml, but VS Code's built-in Outline view shows nothing. The cause is that every symbol's selectionRange is zero-width (start == end) at column 0, which VS Code silently rejects/drops because selectionRange is supposed to span the symbol's clickable name.
Reproduce
- Open a project containing a
requirements.yml in VS Code with the reqstool extension active.
- Open the YAML file and the Outline view (Explorer sidebar).
- Outline is empty.
- With
reqstool.trace.server set to verbose, the server's response to textDocument/documentSymbol is a complete tree — proving the request reaches the server and the server has the data.
Example response (excerpt)
{
"name": "WEB_0001 — Web UI Launch",
"kind": 20,
"range": {"start": {"line": 16, "character": 0}, "end": {"line": 24, "character": 0}},
"selectionRange": {"start": {"line": 16, "character": 0}, "end": {"line": 16, "character": 0}},
"detail": "shall",
"children": [ ... ]
}
selectionRange start equals end — a zero-width point at column 0.
Expected
Per LSP / VS Code, selectionRange should span the identifier text — e.g. cover id: WEB_0001 (or just WEB_0001) on the line where the requirement is declared. With a non-empty selectionRange contained in range, VS Code populates the Outline normally.
Suggested fix
When building DocumentSymbols in src/reqstool/lsp/features/ (the documentSymbol provider), set selectionRange to the actual span of the requirement's id: value in the YAML source rather than (line, 0)–(line, 0).
Environment
- reqstool-vscode 0.1.0 (latest
main)
- VS Code with
reqstool.trace.server: verbose
- Server:
reqstool lsp (pygls)
Summary
The LSP server's
textDocument/documentSymbolresponse returns a fully populated symbol tree forrequirements.yml, but VS Code's built-in Outline view shows nothing. The cause is that every symbol'sselectionRangeis zero-width (start == end) at column 0, which VS Code silently rejects/drops becauseselectionRangeis supposed to span the symbol's clickable name.Reproduce
requirements.ymlin VS Code with the reqstool extension active.reqstool.trace.serverset toverbose, the server's response totextDocument/documentSymbolis a complete tree — proving the request reaches the server and the server has the data.Example response (excerpt)
{ "name": "WEB_0001 — Web UI Launch", "kind": 20, "range": {"start": {"line": 16, "character": 0}, "end": {"line": 24, "character": 0}}, "selectionRange": {"start": {"line": 16, "character": 0}, "end": {"line": 16, "character": 0}}, "detail": "shall", "children": [ ... ] }selectionRangestart equals end — a zero-width point at column 0.Expected
Per LSP / VS Code,
selectionRangeshould span the identifier text — e.g. coverid: WEB_0001(or justWEB_0001) on the line where the requirement is declared. With a non-emptyselectionRangecontained inrange, VS Code populates the Outline normally.Suggested fix
When building DocumentSymbols in
src/reqstool/lsp/features/(the documentSymbol provider), setselectionRangeto the actual span of the requirement'sid:value in the YAML source rather than(line, 0)–(line, 0).Environment
main)reqstool.trace.server: verbosereqstool lsp(pygls)