mirror of
https://github.com/rioskit/obsidian-todo-txt-mode.git
synced 2026-07-22 05:49:24 +00:00
feat: add highlight option for completed tasks in settings
This commit is contained in:
parent
272e059550
commit
39cd86553a
3 changed files with 17 additions and 2 deletions
|
|
@ -37,7 +37,8 @@ const mockSettings: TodoTxtSettings = {
|
|||
recurringTaskColor: '#FF5722',
|
||||
enableRecurringTasks: true,
|
||||
enableAutoCompletionDate: true,
|
||||
enableRecurringTaskCreationDate: false
|
||||
enableRecurringTaskCreationDate: false,
|
||||
highlightDoneFile: true
|
||||
};
|
||||
const mockIsTodoTxtFile = (path: string) => path === 'todo.md';
|
||||
const mockGetSettings = () => mockSettings;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export interface TodoTxtSettings {
|
|||
enableRecurringTasks: boolean;
|
||||
enableAutoCompletionDate: boolean;
|
||||
enableRecurringTaskCreationDate: boolean;
|
||||
highlightDoneFile: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: TodoTxtSettings = {
|
||||
|
|
@ -75,7 +76,8 @@ export const DEFAULT_SETTINGS: TodoTxtSettings = {
|
|||
|
||||
enableRecurringTasks: true,
|
||||
enableAutoCompletionDate: true,
|
||||
enableRecurringTaskCreationDate: false
|
||||
enableRecurringTaskCreationDate: false,
|
||||
highlightDoneFile: true
|
||||
}
|
||||
|
||||
export class TodoTxtSettingTab extends PluginSettingTab {
|
||||
|
|
@ -176,6 +178,13 @@ export class TodoTxtSettingTab extends PluginSettingTab {
|
|||
'doneFilePath'
|
||||
);
|
||||
|
||||
this.createHighlightSetting(
|
||||
containerEl,
|
||||
'Highlight done file',
|
||||
'Apply syntax highlighting to completed tasks file',
|
||||
'highlightDoneFile'
|
||||
);
|
||||
|
||||
new Setting(containerEl).setHeading().setName('Highlighting');
|
||||
|
||||
const styleSettingsInfo = containerEl.createEl('div', {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ export function createTodoTxtExtension(app: App, isTodoTxtFile: (path: string) =
|
|||
return Decoration.none;
|
||||
}
|
||||
|
||||
// Check if highlighting is disabled for done file
|
||||
if (file.path === settings.doneFilePath && !settings.highlightDoneFile) {
|
||||
return Decoration.none;
|
||||
}
|
||||
|
||||
if (file.path !== this.lastFile) {
|
||||
this.lastFile = file.path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue