Skip to content

Commit

Permalink
hotfix: disable debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
vburzynski committed Jan 7, 2024
1 parent 67e2f24 commit 5512b74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/swap-checkbox-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { Editor, EditorSelection } from 'obsidian';
// TODO: ignore certain types of blocks -- like comment blocks and code blocks

class SwapCheckboxStatus {
// reference to the obsidian Editor
editor: Editor;

DEBUG = true;
/**
* When true, the class will output debug console messages
*/
DEBUG = false;

// matches a checklist item:
// start of a line; any amount of whitespace or `>` characters (for callouts);
Expand Down Expand Up @@ -83,7 +85,6 @@ class SwapCheckboxStatus {
// TODO: retain jumping to the end of the line when it is blank
// TODO: this only retains the final cursor selection, nothing else; maybe use `setSelections`
this.editor.setSelection({ line, ch: replacement.length });
this.log('┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉');
}

getLineReplacement(original: string, target: string): string {
Expand Down Expand Up @@ -145,9 +146,12 @@ class SwapCheckboxStatus {

this.log('replacement', replacement);
this.editor.replaceRange(replacement, cursorStart, cursorEnd);
this.log('┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉');
}

/**
* conditional log output
* @param args arguments to pass on to console.log
*/
log(...args: unknown[]) {
this.DEBUG && console.log(...args);
}
Expand Down

0 comments on commit 5512b74

Please sign in to comment.