Solved: File Menu event appears with blank Alias? #313
Replies: 7 comments 17 replies
-
Hi! Thank you for your post and especially for your detailed debug information! 🙂 I suspected a wrong thingI've never seen this bug before,
Actually, the problem I described happened in my development which had unreleased So, the updated situation is that I haven't yet been able to reproduce your problem. I'll try to find a solution for this, after releasing |
Beta Was this translation helpful? Give feedback.
-
Another possible solutionI still can't say that I would have found the cause for this, but here's at least another thing that might help: I've made a fix on 2023-01-01 (not published yet, will be published in So, after |
Beta Was this translation helpful? Give feedback.
-
No change in behaviour with 0.18.0, I'm afraid. |
Beta Was this translation helpful? Give feedback.
-
See debug logs posted on this issue!
…On Sun, Jan 15, 2023 at 3:05 AM Jarkko Linnanvirta ***@***.***> wrote:
Debug
One more thing that came to my mind that might help us hunt down the bug.
If you want you can gather up some more debug information:
1. Open up .obsidian/plugins/obsidian-shellcommands/data.json in an
external editor and change "debug": from false to true. This will
enable extended information logging in Obsidian's console.
2. Reload the shell commands plugin's settings e.g. by simply
restarting Obsidian.
3. Open up console by pressing Cmd + Option + I.
4. Perform a right click on some file in navigation to open up the
file menu.
- See if anything interesting comes up in the console log. The SC
plugin might output quite a lot of stuff there.
- If you see any *red errors* there, it's a clear indicator of a
bug. (This kind of errors can be seen in the console even if debug
is false).
- If no red errors appear, the plugin's own loggings in the console
can still be helpful. If you want, you can post the console log content
here. Just make sure it doesn't contain any private information you don't
want to show publicly.
—
Reply to this email directly, view it on GitHub
<#313 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACC7G3JFKNSEENPX5AQ4DGTWSL2HNANCNFSM6AAAAAATQKTY54>
.
You are receiving this because you were mentioned.Message ID:
<Taitava/obsidian-shellcommands/repo-discussions/313/comments/4686511@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Summary of the screen shareThank you @breaker-of-stone for the remote meeting today! I'll write a short summary of my conclusions of the bug just for the record.
|
Beta Was this translation helpful? Give feedback.
-
Understood and accepted.
Thank you once again!
Ian
…On Sun, Jan 22, 2023 at 3:35 PM Jarkko Linnanvirta ***@***.***> wrote:
Summary of the screen share
Thank you @breaker-of-stone <https://github.com/breaker-of-stone> for the
remote meeting today! I'll write a short summary of my conclusions of the
bug just for the record.
- When adding an item to Obsidian's menu, Menu.addItem()
<https://github.com/obsidianmd/obsidian-api/blob/38dd22168d2925086371bfc59e36fd9121527a39/obsidian.d.ts#L2256-L2260>
is passed a callback function that is responsible for setting up a menu
text for the item (and it also sets an icon if wanted).
- The function that the SC plugin passes to Obsidian is *asynchronous*
<https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous>,
meaning that Obsidian's menu creation probably will not wait for the
function to finish setting up a text *if it takes long*.
- The function is asynchronous because it needs to parse possible
variables in the shell command's alias text in order to show e.g. a file
name instead of {{event_file_name}} in the menu. Some variables take a
long time to parse, so the parsing process has to be asynchronous.
@breaker-of-stone <https://github.com/breaker-of-stone>'s use case
does not use variables in the alias text (aka. menu title), so it doesn't
even need this parsing, but variable parsing is done anyway just in case.
- The problem is that SC sets the menu text too late. Obsidian doesn't
show menu texts that "arrive" late.
- Fix: Set a menu text before parsing any possible variables in it.
The text might be e.g. Open file {{event_file_name}} in app X. Then
update the text after the parsing is done, so it will become e.g. Open
file MyNote.md in app X. The updated text *will not appear on systems
that are affected by this delay problem* (I assume that to be macOS
only?). But at least an unparsed text like Open file
{{event_file_name}} in app X will be shown. It's better than nothing 🙂
.
- For the future, make a feature request to Obsidian that would make
Menu.addItem()
<https://github.com/obsidianmd/obsidian-api/blob/38dd22168d2925086371bfc59e36fd9121527a39/obsidian.d.ts#L2256-L2260>
support asynchronous functions, i.e. so that Obsidian would wait for an
asynchronous function to finish before showing the menu.
—
Reply to this email directly, view it on GitHub
<#313 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACC7G3PIZPI5TA6SFGAPZY3WTTPN3ANCNFSM6AAAAAATQKTY54>
.
You are receiving this because you were mentioned.Message ID:
<Taitava/obsidian-shellcommands/repo-discussions/313/comments/4748181@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Working correctly - awesome!
Thanks Jarkko!
…On Mon, Jan 23, 2023 at 1:32 AM Jarkko Linnanvirta ***@***.***> wrote:
@breaker-of-stone <https://github.com/breaker-of-stone> 0.18.1 is now
released. Please let me know if you still have any problems or other
questions. 🙂
—
Reply to this email directly, view it on GitHub
<#313 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACC7G3L24QOXAFPRQXCWMTLWTVVJTANCNFSM6AAAAAATQKTY54>
.
You are receiving this because you were mentioned.Message ID:
<Taitava/obsidian-shellcommands/repo-discussions/313/comments/4750553@
github.com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(dup. from Obsidian forum)
Issue, or lack of understanding?: I am using Obs. 1.1.9 on a Mac Pro under MacOS Ventura.
I have one shell command registered and it functions correctly, however where the alias should appear in the file context menu is a blank item:
What am I missing?
A screen shot of the settings summary:
Command is:
open -a Atom {{event_file_path:absolute}}
(Obsidian) SYSTEM INFO:
Obsidian version: v1.1.9
Installer version: v1.1.8
Operating system: Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 22.1.0
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 3
Plugins enabled: 1
1: Shell commands v0.17.0
Beta Was this translation helpful? Give feedback.
All reactions