fix: respect disabled frontmatter on rename and note creation#741
Open
mgajewskik wants to merge 1 commit intoobsidian-nvim:mainfrom
Open
fix: respect disabled frontmatter on rename and note creation#741mgajewskik wants to merge 1 commit intoobsidian-nvim:mainfrom
mgajewskik wants to merge 1 commit intoobsidian-nvim:mainfrom
Conversation
Member
|
sorry for the late response respecting frontmatter.enabled is definitely important, especially in the rename I see two potential issues in the implementation:
I'd say we just focus on making the rename right in this PR, you can look into the stale frontmatter issue, if it is not worth it we can just merge it as it is. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
frontmatter.enabled = falsefrontmatter.enabled = falseWhat changed
This PR fixes two paths that could still introduce YAML frontmatter even when frontmatter management was explicitly disabled.
save_to_buffer(), which bypassed the frontmatter guard.The fix makes both flows respect the same frontmatter decision logic used elsewhere in the plugin.
Implementation details
lua/obsidian/lsp/handlers/_rename.luato usenote:update_frontmatter(note.bufnr)instead of unconditionally saving frontmatter to the bufferlua/obsidian/templates.luato strip leading YAML frontmatter from cloned templates when the destination note should not save frontmatterTests
Added regression coverage for:
Verification
stylua --check .selene --config selene/config.toml lua/ tests/typos luamake testlua-language-server --configpath .luarc.json --checkon the changed files