datacore icon indicating copy to clipboard operation
datacore copied to clipboard

[BUG] & FR Tasks handling

Open sergeict opened this issue 5 months ago • 0 comments

Tasks are an important feature of Obsidian, mainly thanks to the "Tasks" plugin. An integration with dataview and metaData Menu allowed for interesting handling and editing of tasks / TODO lists, but has some limits, tough.

I investigated tasks behaviour from DataCore (0.1.24). Here is the result of those investigations, as well as some suggestions. I also had a look at the code of "extractSpecialTasksFields" to better understand the problems.

  • we can obtain a list of taskes, altough they cannot be edited ;
  • [BUG]text cannot be stripped and gives the full text
  • [BUG] status does not work and [FR] should refer to the complete list of statuses and symbols used by Tasks ;
  • [BUG] $symbol, $path cannot be read
  • Tasks works better with emojis. [FR] issue 96, pull request 100, -- [BUG] This is not working at all. No task-related fields work, except "completed", whichever syntax we use (mapping with name, $name or value("name")). The regex parsing in extractSpecialTaskFields(line: string): LocalInlineField[] seems to be working on a line of text formatted as a task with emojis with the limits below, but does not work in DataCore 0.1.24. I also note that some fields are not handled at all but could easily be so, by adding code like this ` // in Emoji shorthand regexes, add the lines const CANCELLED_DATE_REGEX = /\u{274C}\s*(\d{4}-\d{2}-\d{2})/u; const ON_COMPLETION_REGEX = /\u{1F3C1}\s*(Keep|Delete)?/u; // Keep (default or action ("Keep" or "Delete") const DEPENDS_ON_REGEX = /\u{26D4}\s*(\w+)\s*(,\s*\w+)/u; // comma seprated occurences of low/up letters, digits, underscore or hyphen, any number const ID_REGEX = /\u{1F194}\s(\w+)/u; // single occurence of low/up letters, digits, underscore or hyphen, any number

// at the end of the object EMOJI_REGEXES, add { regex: CANCELLED_DATE_REGEX, key: "cancelled" }, { regex: ON_COMPLETION_REGEX, key: "onCompletion" }, { regex: DEPENDS_ON_REGEX, key: "dependsOn" }; { regex: ID_REGEX, key: "id" }; `

// You can parse priority shorthand emojis, like this, by adding // priority shorthands, regexes const PRIORITY_LOWEST_REGEX = /(\u{23EC})/u; const PRIORITY_LOW_REGEX = /(\u{1F53D})/u; const PRIORITY_MEDIUM_REGEX = /(\u{1F53C})/u; const PRIORITY_HIGH_REGEX == /(\u{23EB})/u; const PRIORITY_HIGHEST_REGEX = /(\u{1F53A})/u; // no emoji means normal priority

// add a new object, note the "value:" field and the same "key:" const PRIORITY_REGEXES = [ { regex: PRIORITY_LOW_REGEX, key: "priority", value: "low" }, { regex: PRIORITY_MEDIUM_REGEX, key: "priority", value: "medium" }, { regex: PRIORITY_HIGH_REGEX, key: "priority", value: "high" }, { regex: PRIORITY_HIGHEST_REGEX, key: "priority", value: "highest" }, ]; // not found -> use key: priority & value: "normal"

// add code like the following lines after the loop "for (let { regex, key } of EMOJI_REGEXES) {" // 2- MATCHING PRIORITY SHORTHANDS ( only a single emoji depending on priority, or "normal" if none is found const found = false; for (let { regex, key, value } of PRIORITY_REGEXES) { const match = regex.exec(line); if (!match) continue; results.push({ key, value: value, start: match.index, startValue: match.index, end: match.index + 1, wrapping: "emoji-shorthand", }); } if (!found) { // priority = normal results.push({ "priority", value: "normal", start: 0, startValue: 0, end: 0, wrapping: "emoji-shorthand", }); }

-- [FR] add handling of the recurrence, which is a bit more cmplex since it uses natural date without a specific pattern

-- [BUG] none of the task-related

-- [BUG] As you may note in the example below, fields are accessible, getting the $fields or by value (like row.value("F"); f: key: F, raw: first, value: first, position: line: 27, start: 31, startValue: 35, end: 42, wrapping: [, g: key: G, raw: second, value: second, position: line: 27, start: 60, startValue: 64, end: 72, wrapping: [

-- [BUG] now, if we select the "dataview" format for the tasks, in the Task plugin options, the fields are recognized as standard ones, not task specific ones.

Can you check this please.

Thanks in advance

sergeict avatar Jul 30 '25 14:07 sergeict