hikchoi
02/12/2021, 3:20 AMkevins8
02/12/2021, 3:55 AMhikchoi
02/12/2021, 3:57 AMhikchoi
02/12/2021, 3:58 AMkevins8
02/12/2021, 4:21 AMhikchoi
02/12/2021, 4:24 AMhikchoi
02/12/2021, 4:25 AMkevins8
02/12/2021, 4:31 AMkevins8
02/13/2021, 12:55 AMhikchoi
02/13/2021, 2:40 AMhikchoi
02/13/2021, 3:30 PMhikchoi
02/13/2021, 3:31 PMhikchoi
02/13/2021, 3:42 PMhikchoi
02/13/2021, 3:44 PMkevins8
02/13/2021, 4:15 PMfoldOnOpen
is fine for now: window.onDidChangeActiveTextEditor
That plus a flag to ignore folding.kevins8
02/13/2021, 4:15 PMhikchoi
02/14/2021, 1:35 AMhikchoi
02/14/2021, 1:38 AMDNodePropsV2
?hikchoi
02/14/2021, 1:41 AMhikchoi
02/14/2021, 1:41 AMhikchoi
02/14/2021, 2:03 AMa.md
and b.md
is open. both have frontmatter unfolded. current active editor is a.md
2. switch over to b.md
. `b.md`'s frontmatter should fold.
3. a.md
is still open on vscode. switch over to a.md
and the frontmatter should fold.
what I meant by
> 2. only fold on open
was :
1. note a.md
is not opened on vscode.
2. open a.md
either by lookup or clicking it on the file explorer.
3. if the frontmatter is unfolded, fold it.
this way we aren't triggering it on every active editor change, just when it first opens. front matter folding will stay how it is until it's closed. the user can unfold it if they want, and it it will stay unfolded until they close the tab and open it up again.
so I was wondering if there was a watcher that watches for new tabs opening, not switching between already open tabs.
(I currently have it so that the folding behavior triggers in windowWatcher
after it triggers update decoration.)kevins8
02/14/2021, 3:53 AMworkspace.onDidOpenTextDocument: Event<TextDocument>
event that we can hook into
we can put that in here: https://github.com/dendronhq/dendron/blob/master/packages/plugin-core/src/WorkspaceWatcher.ts#L20:L20kevins8
02/14/2021, 3:53 AMhikchoi
02/14/2021, 4:10 AMhikchoi
02/14/2021, 1:29 PMonDidOpenTextDocument
fires and the activeTextEditor
changes to the opened file. Gotta find a way to wait for the activeTextEditor
to be set to the opened file without arbitrarily sleeping 🤔hikchoi
02/14/2021, 2:24 PMsetTimeout
works good enough 🤷♂️hikchoi
02/14/2021, 2:34 PMonDidChangeActiveTextEditor
instead of onDidOpenTextDocument
😄 more head scratching tomorrow.kevins8
02/14/2021, 4:41 PMThe event is emitted before the document is updated in the active text editor
. it is also not emitted if the document was already open
i think onDidChangeActiveTextEditor
always fires.
this might require more digging into vscode api. one thing we could do for now is split up the folding provider functionality from automatic folding.hikchoi
02/14/2021, 9:05 PM