Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The plugin doesn't ignore the files when using the File Save Hook #98

Closed
d0verenny opened this issue Jan 11, 2025 · 7 comments
Closed

Comments

@d0verenny
Copy link

When setting up the folder (mine is TemplateR/.*), the plugin keeps renaming the file. The ones added via command, too.

STR:

  1. Set up the folder with ignored files in Ingore Regex Rule or use Ignore Current File command on a file
  2. Open an *.md file with a text and a header in it, that differs from the file name
  3. Use Сtrl + Save to save the file
  4. See the Header being renamed into the file name

My Ignore File settings:

image

image

The file before Ctrl+S

Obsidian_MLWyLcdS9Z

The file after Ctrl+S

Obsidian_oAlGeMpGok

@dvcrn
Copy link
Owner

dvcrn commented Jan 11, 2025

Hi, could you give this in-dev version a try: #55 (comment)

It adds support for waiting for Templater hooks. i'm not a Templater user so would like to understand if this is resolving those issues for you

@d0verenny
Copy link
Author

d0verenny commented Jan 12, 2025

Hi!. It doesn't have to do anything with Templater itself. The problem persists in any file, even with Templater plugin turned off. I tested it.

And I don't think Tamplater reacts to Save current file (default keys: Ctrl+S) command, anyway, since it only activates once, on Insert of a template or a Creation of a note.

I also tried to replace the main.js file you provided in the ##55 Comment, just in case. As expected, it didn't change anything.

I will be happy to help with any tests related to the issue.

Thanks!

@dvcrn
Copy link
Owner

dvcrn commented Jan 12, 2025

Thanks for reporting back, let me see if I can reproduce this here. I know that we have some race condition with Templater, but in all other cases, there is a guard when the file is ignored:

https://github.com/dvcrn/obsidian-filename-heading-sync/blob/master/main.ts#L162

Can you list the plugins you have enabled? Open dev tools and type app.workspace.app.plugins.enabledPlugins

@d0verenny
Copy link
Author

As stated before, I turned off Templater for now.

There you go:

new Set([
    "obsidian-advanced-slides",
    "table-editor-obsidian",
    "obsidian-better-audio-recorder",
    "obsidian-better-command-palette",
    "better-word-count",
    "calendar",
    "obsidian-collapse-all-plugin",
    "workspaces-plus",
    "various-complements",
    "tag-wrangler",
    "obsidian-style-settings",
    "obsidian-spaced-repetition",
    "obsidian-snippet-downloader",
    "obsidian-show-file-path",
    "obsidian-shellcommands",
    "obsidian-regex-replace",
    "obsidian-quiet-outline",
    "darlal-switcher-plus",
    "quick-explorer",
    "obsidian-pandoc",
    "novel-word-count",
    "obsidian-outliner",
    "moviegrabber",
    "mousewheel-image-zoom",
    "obsidian-local-rest-api",
    "obsidian-kanban",
    "obsidian-icon-folder",
    "obsidian-fullscreen-plugin",
    "obsidian-folder-focus-mode",
    "find-unlinked-files",
    "obsidian-excel-to-markdown-table",
    "obsidian-excalidraw-plugin",
    "dataview",
    "obsidian-custom-frames",
    "search-on-internet",
    "obsidian-languagetool-plugin",
    "code-styler",
    "obsidian-auto-link-title",
    "find-and-replace-in-selection",
    "obsidian-importer",
    "obsidian-local-images-plus",
    "multi-properties",
    "multi-line-formatting",
    "webpage-html-export",
    "obsidian-kindle-plugin",
    "obsidian-git",
    "recent-files-obsidian",
    "discord-message-formatter",
    "obsidian-filename-heading-sync"
])

@dvcrn
Copy link
Owner

dvcrn commented Jan 12, 2025

As stated before, I turned off Templater for now.

Yes but my suspicion is another race condition with something else that listens on save hook. A lot of plugins do that 😄

@d0verenny
Copy link
Author

d0verenny commented Jan 12, 2025

I did some testing.

  1. I turned off all the plugins, except for the obsidian-filename-heading-sync.
  2. Restarted Obisian
  3. Opened the file Ignored in the settings of the plugin. The Save Hook is also turned off in the setings of the plugin.
  4. Pressed Ctrl+S
  5. The header is still renamed.

The problem persists. Other plugins have nothing to do with it, unfortunately.

@d0verenny
Copy link
Author

I feel stupid... I just noticed that I had the same keys for Save and Sync Filename to Heading commands (Ctrl+S)... It's not a bug. Everything works as expected. Sorry for disturbance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants