quickadd icon indicating copy to clipboard operation
quickadd copied to clipboard

[BUG] QuickAdd: (ERROR) unable to find insert after line in file.

Open iAK01 opened this issue 3 years ago • 3 comments

I'm using the goals/projects template (thanks!) and trying to trial it. However, I have noticed an issue with adding to the Kanban board; specifically when choosing "Quick Add > Goal". I can add to the "Professional" okay but there rest don't work. I suspect it has something to do with this line in quick add:

{{VALUE:Professional, Physical, Knowledge, Wealth, Life}}

As "Professional" is first, it works, But "Life" or "Knowledge" return the following error: QuickAdd: (ERROR) unable to find insert after line in file. Is it something to do with spaces? Or more likely a conflicting plugin on my system?

To Reproduce I can only successfully add Professional. The others, no. I have narrowed it down to the above syntax.

  • OS macOS Monterey
  • Obsidian v 0.15.9
  • QuickAdd v 0.5.5

iAK01 avatar Aug 15 '22 16:08 iAK01

Same issue here.

melvinwevers avatar Aug 19 '22 12:08 melvinwevers

Actually I just found a simple fix. Get rid of the spaces in the string above so its: {{VALUE:Professional,Physical,Knowledge,Wealth,Life}}

iAK01 avatar Aug 19 '22 12:08 iAK01

I also ran into this problem and I understood the reason by looking at the source code, this is because, here the value in the Insert after has to be present in the target file and then the Capture format value is inserted after this string. That's the logic. This is not a bug, it is easy to misinterpret it as inserting after the document.

Source code address: https://github.com/chhoumann/quickadd/blob/e1d4a14cc883d9aed5f123cecf1798ce32b69191/src/formatters/captureChoiceFormatter.ts#L93

So, assuming the target document is

xxxxx ## hello yyyyy

Then just set the following in Capture

image

After execution, it will be

xxxxx ## hello world yyyyy

wish5115 avatar Jun 10 '24 11:06 wish5115