1
0

Add Fold: Toggle Fold command

This commit is contained in:
Zef Hemel 2023-06-17 09:01:32 +02:00
parent 5f1f02e8b9
commit eefd8a5245
5 changed files with 19 additions and 0 deletions

View File

@ -94,6 +94,7 @@ export {
StreamLanguage,
syntaxHighlighting,
syntaxTree,
toggleFold,
unfoldAll,
unfoldCode,
} from "@codemirror/language";

View File

@ -139,6 +139,10 @@ export function unfold() {
return syscall("editor.unfold");
}
export function toggleFold() {
return syscall("editor.toggleFold");
}
export function foldAll() {
return syscall("editor.foldAll");
}

View File

@ -382,6 +382,12 @@ functions:
name: "Fold: Unfold"
mac: "Cmd-Alt-]"
key: "Ctrl-Shift-]"
toggleFoldCommand:
path: ./editor.ts:toggleFoldCommand
command:
name: "Fold: Toggle Fold"
mac: "Cmd-Alt-f"
key: "Ctrl-Shift-f"
foldAllCommand:
path: ./editor.ts:foldAllCommand
command:

View File

@ -26,6 +26,10 @@ export async function unfoldCommand() {
await editor.unfold();
}
export async function toggleFoldCommand() {
await editor.toggleFold();
}
export async function foldAllCommand() {
await editor.foldAll();
}

View File

@ -3,6 +3,7 @@ import {
EditorView,
foldAll,
foldCode,
toggleFold,
Transaction,
unfoldAll,
unfoldCode,
@ -188,6 +189,9 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
"editor.unfold": () => {
unfoldCode(editor.editorView!);
},
"editor.toggleFold": () => {
toggleFold(editor.editorView!);
},
"editor.foldAll": () => {
foldAll(editor.editorView!);
},