chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.54k stars 137 forks source link

Syntax error: unexpected identifier #417

Closed clearf closed 1 year ago

clearf commented 1 year ago

I am running Obsidian 1.1.16; QuickAdd 0.11.10 and, after upgrading (first to QuickAdd .08 and now to .10) I'm getting a syntax error when running a capture commend.

image

I have not changed the existing capture commands, but they are now throwing an error.

If I create a new capture command that simply inserts something to the bottom of a file it works.

Here's a command that doesn't work: image image

Here's a very simple capture command that I just setup that is working:

image

What am I missing?

clearf commented 1 year ago

Update: I just deleted all my existing QuickAdd actions and added a new one trying to insert a formatted value into a file. I fails with the same error.

image image

The error appears to be thrown by onChooseCaptureType.run called on Line 16261 if that helps.

  async onChooseCaptureType(captureChoice) {
    await new CaptureChoiceEngine(
      this.app,
      this.plugin,
      captureChoice,
      this
    ).run();
chhoumann commented 1 year ago

Hi @clearf

Thanks for reporting this! I'm having trouble recreating the issue, so I'm wondering if it's some issue with the data.json file. Can you try renaming the data.json in the QuickAdd plugin folder to data_backup.json? Don't want to delete it, but just force QuickAdd to create a new one.

Before renaming the file, please close Obsidian. It is fine to open again after renaming it.

The file will be located in your Obsidian vault, first in the .obsidian folder, then plugins, then quickadd, and finally there you'll find the file. So: vaultFolder/.obsidian/plugins/quickadd/data.json

Once you've opened Obsidian again, you won't have any of the QuickAdd settings. But please try creating a capture again and seeing if that works.

clearf commented 1 year ago

Hi @chhoumann,

I went back to try and reproduce, and I think I figured out the vexing problem via trial and error — there was a rogue Javascript file, loaded by another template (Templater) that somehow broke QuickAdd.

Obviously a strange corner case — right now I wonder if this is a documentation fix or better error messages rather than a technical fix.

Thanks, be well, and stay curious, Chris Clearfield MELTDOWN @.**@.> webhttp://www.chrisclearfield.com/ | bookhttp://www.meltdownbook.net/ | linkedinhttps://www.linkedin.com/in/chrisclearfield/ | the twitterhttps://twitter.com/chrisclearfield

p.s. Are you signed up for mailing list on leading with curiosity? Sign up herehttps://clearfieldgroup.ck.page/email because I think you might enjoy it: https://clearfieldgroup.ck.page/email

On Mon, Apr 03, 2023 at 4:50 AM, Christian Bager Bach Houmann @.**@.>> wrote:

Hi @clearfhttps://github.com/clearf

Thanks for reporting this! I'm having trouble recreating the issue, so I'm wondering if it's some issue with the data.json file. Can you try renaming the data.json in the QuickAdd plugin folder to data_backup.json? Don't want to delete it, but just force QuickAdd to create a new one.

Before renaming the file, please close Obsidian. It is fine to open again after renaming it.

The file will be located in your Obsidian vault, first in the .obsidian folder, then plugins, then quickadd, and finally there you'll find the file. So: vaultFolder/.obsidian/plugins/quickadd/data.json

Once you've opened Obsidian again, you won't have any of the QuickAdd settings. But please try creating a capture again and seeing if that works.

— Reply to this email directly, view it on GitHubhttps://github.com/chhoumann/quickadd/issues/417#issuecomment-1494177707, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAO2XJUXNZRECF4YB66UBT3W7K2Q3ANCNFSM6AAAAAAVUIZBQU. You are receiving this because you were mentioned.Message ID: @.***>

chhoumann commented 1 year ago

Now that you mention it, I actually recall this issue. It has been going on for a while, and is due to Templater not recognizing any script except those that follows a certain supported format.

Here's a fix for anyone seeing this issue in the future: Templater needs its own specific scripts folder, or very odd errors will start appearing. My solution has been to create a Templater folder inside my scripts folder, i.e. bins/scripts/templater.

This should be set in the Templater settings, like so: image

Having this issue here should help anyone with this issue in the future. Will update docs with a link here.

clearf commented 1 year ago

Thanks! [??]

Thanks, be well, and stay curious, Chris Clearfield MELTDOWN @.**@.> webhttp://www.chrisclearfield.com/ | bookhttp://www.meltdownbook.net/ | linkedinhttps://www.linkedin.com/in/chrisclearfield/ | the twitterhttps://twitter.com/chrisclearfield

p.s. Are you signed up for mailing list on leading with curiosity? Sign up herehttps://clearfieldgroup.ck.page/email because I think you might enjoy it: https://clearfieldgroup.ck.page/email

On Mon, Apr 03, 2023 at 11:53 AM, Christian Bager Bach Houmann @.**@.>> wrote:

Now that you mention it, I actually recall this issue. It has been going on for a while, and is due to Templater not recognizing any script except those that follows a certain supported format.

Here's a fix for anyone seeing this issue in the future: Templater needs its own specific scripts folder, or very odd errors will start appearing. My solution has been to create a Templater folder inside my scripts folder, i.e. bins/scripts/templater.

This should be set in the Templater settings, like so: [image]https://user-images.githubusercontent.com/29108628/229600082-39677dd5-f1ef-4c2f-9866-9c6b7bd453c3.png

Having this issue here should help anyone with this issue in the future. Will update docs with a link here.

— Reply to this email directly, view it on GitHubhttps://github.com/chhoumann/quickadd/issues/417#issuecomment-1494814258, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAO2XJSAJYBJCX7KSBCDSUTW7MMCXANCNFSM6AAAAAAVUIZBQU. You are receiving this because you were mentioned.Message ID: @.***>