Skip to content

Commit 958105c

Browse files
committed
refactor: - get the include field from the settings
1 parent 59aef9d commit 958105c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Scripting/QueryContext.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getSettings } from '../Config/Settings';
12
import type { Task } from '../Task/Task';
23
import type { TasksFile } from './TasksFile';
34

@@ -58,8 +59,6 @@ export function makeQueryContextWithTasks(tasksFile: TasksFile, allTasks: Readon
5859
allTasks: allTasks,
5960
searchCache: {}, // Added for caching
6061
},
61-
include: {
62-
not_done: 'not done',
63-
},
62+
include: { ...getSettings().include },
6463
};
6564
}

tests/Scripting/Includes.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getSettings, resetSettings } from '../../src/Config/Settings';
1+
import { getSettings, resetSettings, updateSettings } from '../../src/Config/Settings';
22
import { Query } from '../../src/Query/Query';
33
import { TasksFile } from '../../src/Scripting/TasksFile';
44

@@ -8,6 +8,8 @@ afterEach(() => {
88

99
describe('include tests', () => {
1010
it('should accept whole-line include placeholder', () => {
11+
updateSettings({ include: { not_done: 'not done' } });
12+
1113
const source = '{{include.not_done}}';
1214
const query = new Query(source, new TasksFile('stuff.md'));
1315

0 commit comments

Comments
 (0)