( app: App, file: TFile, )
| 267 | } |
| 268 | |
| 269 | async 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 |
no test coverage detected