[api] Allow extensions to determine if a position is within a fold
See original GitHub issueThis has been the most demanded feature of VSCodeVim: VSCodeVim/Vim#1004 for over 3 years.
The main problem with Folds and Vim is that some motions will skip right over folded areas (like moving up/down). We need to know if we are in a folded area so we can iterate these motions until we are out of the fold.
An API like vscode.window.activeTextEditor.getAllFoldedRegions(): vscode.Range[]
would be ideal.
An API like vscode.window.activeTextEditor.isPositionInFold(position: vscode.Position): boolean
would also be great.
This is technically a duplicate for 22276, but that was closed because the roadmap at the time couldn’t include this ticket.
Maybe it’s time to revisit this? It has been blocking the most demanded feature of one of the most popular plugins out there, for 3+ years.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:145
- Comments:6 (1 by maintainers)
Top GitHub Comments
Couldn’t extensions express interest in using this information, so that the UI process knows whether it should do that or not?
Also, Code is firing a telemetry event on every arrow press, and I imagine that’s not much better.
please see @alexandrudima comment on this issue, he summarizes the core problem perfectly https://github.com/microsoft/vscode/issues/22276#issuecomment-302061827
here is the TLDR:
TextEditor.selection
API, we must proactively push the selection, every time it changes, from the UI process to the extension host, even if there is an extension interested in reading the selection or not.