You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[api] Allow extensions to determine if a position is within a fold #81498
This 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.
Reacted by Nicole L, Aetf, Jason Fields, David Alan Hjelle, Mark Porter, phrohdoh, Amit Levy, Miles Frain, Lukas Cenovsky, raylu and 148 more
Reacted by aesyondu, Kyle Cureau, Akshay P, yacine, Hamza Pavlovič, AGTI-fonts, waynema02, Periwink, Felipe Emos, Gabriel and 11 more
any reading API must be synchronous and must be pushed eagerly by the UI process to the extension host.
in other words, if we have a 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.
changed the title [-]Allow extensions to determine if a position is within a fold[/-][+][api] Allow extensions to determine if a position is within a fold[/+]on Nov 6, 2020
Activity
vscodebot commentedon Sep 26, 2019
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
MondoGao commentedon Sep 27, 2019
It's pretty annoying when you try to use some stuff like '#region', hope I had some time to fix this.
fatfatson commentedon Sep 27, 2019
vote +1
aminroosta commentedon Sep 27, 2019
please see alexandrudima comment on this issue, he summarizes the core problem perfectly
#22276 (comment)
here is the TLDR:
TextEditor.selectionAPI, 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.lnicola commentedon Sep 27, 2019
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.
aminroosta commentedon Sep 27, 2019
It’s the classic dependency inversion principle which is intentionally done.
[-]Allow extensions to determine if a position is within a fold[/-][+][api] Allow extensions to determine if a position is within a fold[/+]costincaraivan commentedon Nov 1, 2023
Ping 🙂 It's been 4 years, any chance this will end up in a backlog/sprint?
alexdima commentedon Mar 5, 2026
Steps to verify:
Cmd+Option+[)keybindings.json:[ { "key": "ctrl+alt+down", "command": "cursorMove", "args": { "to": "down", "by": "foldedLine" }, "when": "editorTextFocus" }, { "key": "ctrl+alt+up", "command": "cursorMove", "args": { "to": "up", "by": "foldedLine" }, "when": "editorTextFocus" }, { "key": "ctrl+alt+shift+down", "command": "cursorMove", "args": { "to": "down", "by": "foldedLine", "select": true }, "when": "editorTextFocus" }, { "key": "ctrl+alt+shift+up", "command": "cursorMove", "args": { "to": "up", "by": "foldedLine", "select": true }, "when": "editorTextFocus" } ]Test Cases
Ctrl+Alt+Down→ lands on first line after the foldCtrl+Alt+Up→ lands on line before the fold"by": "line"Ctrl+Alt+Shift+Down/Upextends selection while skipping folds