MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / handleStatusBarClick

Method handleStatusBarClick

src/ui/StatusBarService.ts:373–411  ·  view source on GitHub ↗

* Handle click on status bar - open task note(s)

()

Source from the content-addressed store, hash-verified

371 * Handle click on status bar - open task note(s)
372 */
373 private async handleStatusBarClick(): Promise<void> {
374 try {
375 // Get tracked tasks
376 const trackedTasks = await this.getTrackedTasks();
377
378 if (trackedTasks.length === 0) {
379 return;
380 }
381
382 if (trackedTasks.length === 1) {
383 // Single tracked task - open its note directly
384 const task = trackedTasks[0];
385 const file = this.plugin.app.vault.getAbstractFileByPath(task.path);
386 if (file instanceof TFile) {
387 await this.plugin.app.workspace.getLeaf(false).openFile(file);
388 }
389 } else {
390 // Multiple tracked tasks - show selector modal
391 openTaskSelector(this.plugin, trackedTasks, (selectedTask) => {
392 void (async () => {
393 if (selectedTask) {
394 const file = this.plugin.app.vault.getAbstractFileByPath(
395 selectedTask.path
396 );
397 if (file instanceof TFile) {
398 await this.plugin.app.workspace.getLeaf(false).openFile(file);
399 }
400 }
401 })();
402 });
403 }
404 } catch (error) {
405 tasknotesLogger.error("Error handling status bar click:", {
406 category: "internal",
407 operation: "handling-status-bar-click",
408 error: error,
409 });
410 }
411 }
412
413 /**
414 * Request an update to the status bar (debounced)

Callers 1

Calls 5

getTrackedTasksMethod · 0.95
openTaskSelectorFunction · 0.90
getAbstractFileByPathMethod · 0.80
getLeafMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected