MCPcopy Create free account
hub / github.com/chhoumann/quickadd / pickInsertMode

Function pickInsertMode

src/engine/applyTemplateToActiveNote.ts:269–289  ·  view source on GitHub ↗
(
	app: App,
	file: TFile,
)

Source from the content-addressed store, hash-verified

267}
268
269async function pickInsertMode(
270 app: App,
271 file: TFile,
272): Promise<TemplateInsertModeId | null> {
273 const cursorAvailable = Boolean(getMarkdownEditorViewForFile(app, file));
274 const modes = templateInsertModes.filter(
275 (mode) => mode.id !== "cursor" || cursorAvailable,
276 );
277
278 try {
279 return await GenericSuggester.Suggest(
280 app,
281 modes.map((mode) => mode.label),
282 modes.map((mode) => mode.id),
283 "How should the template be applied?",
284 );
285 } catch (error) {
286 if (isCancellationError(error)) return null;
287 throw error;
288 }
289}
290
291/**
292 * If the picked Template choice would have created the note at a different

Callers 1

applyTemplateToNoteFunction · 0.85

Calls 3

isCancellationErrorFunction · 0.90
SuggestMethod · 0.45

Tested by

no test coverage detected