Add code symbols into outline#972
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
I attempted to add tests until I remembered that our test setup does not have actual LSPs for Python or R in it, so we can't really test this. Well... now that I write that, I realize I could probably mock one out. That seems a little contrived, but maybe still worth it. |
|
I was able to reproduce duplicated language symbols in code cells in Positron with inline outputs enabled. Looking into what is happening. |
|
@juliasilge In await commands.executeCommand<DocumentSymbol[] | SymbolInformation[]>(
"vscode.executeDocumentSymbolProvider",
uri
);I checked the surrounding context, including the vdoc content. Everything seems to be in order, nothing strange otherwise. When I disabled |
|
Cell Diagnostics tests were failing with a message about timing out in CI. The current run of the tests passed, but there wasn't a code change that would've affected the tests or the code tested. The tests seem to be flakey for some reason. Let's keep our eye on that. |
juliasilge
left a comment
There was a problem hiding this comment.
I looked into the issue with inline output and it is some change we'll need to make over on the Positron side; I'll log that once this is merged.
I do think we need to add at least some basic tests, with a fake in-process symbol provider (not a real LSP). We already do this for the formatting tests. I think the steps would be:
- Register a temporary provider in
symbols.test.tswithvscode.languages.registerDocumentSymbolProvider({ scheme: "file", pattern: "**/.vdoc.*" }, ...)so it only handles Quarto virtual docs. - Make that provider return each shape in separate tests:
DocumentSymbol[]SymbolInformation[]undefined
- Run
vscode.executeDocumentSymbolProvideronformat/basics.qmdor another example file and assert:- no throw for
undefined - code-cell symbols still exist
- returned embedded symbol names appear under/alongside code-cell outline entries for both result shapes.
- no throw for
That will give us coverage of the middleware logic without having to set up real LSPs.
|
Ok I added tests but frustratingly was not able to get them to work when run in sequence, only in isolation. Doubly confusing is that mocking a SymbolInformation provider somehow results in duplicated results in the outline in the test, but idk why. Couldn't figure it out today :| |
|
In a0506c9 I made some changes to how we run this new testing. The I added a new helper function to address this in |
|
I opened posit-dev/positron#13907 to fix the duplicated symbols with inline output. |

Addresses an issue mentioned by @juliasilge: #167 (comment)
Adds code symbols under code cells in the outline.