Skip to content

refactor: deprecate is_markdown_buffer and remove dead-code callers#206

Open
YousefHadder wants to merge 1 commit intomainfrom
refactor/remove-deprecated-is-markdown-buffer
Open

refactor: deprecate is_markdown_buffer and remove dead-code callers#206
YousefHadder wants to merge 1 commit intomainfrom
refactor/remove-deprecated-is-markdown-buffer

Conversation

@YousefHadder
Copy link
Owner

@YousefHadder YousefHadder commented Feb 8, 2026

Summary

Deprecate utils.is_markdown_buffer() (which always returns true) with a vim.deprecate() warning targeting removal in 2.0.0. Filetype filtering is handled by the autocmd pattern in init.lua, making this check redundant.

The function is preserved with a deprecation notice so any external callers get a clear warning instead of a hard break.

Changes

  • Add vim.deprecate() call to is_markdown_buffer() in utils.lua
  • Remove dead-code guard blocks from 8 module enable() functions: callouts, format, footnotes, list, links, images, quote, headers
  • Remove unused utils imports from 4 modules that only used it for this function
  • Remove corresponding tests from utils_spec.lua (the function is deprecated, not tested)

Copilot AI review requested due to automatic review settings February 8, 2026 18:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the deprecated utils.is_markdown_buffer() helper (which always returned true) and simplifies feature module enable() implementations by dropping redundant guards, relying on init.lua’s FileType autocmd filtering instead.

Changes:

  • Removed is_markdown_buffer() from lua/markdown-plus/utils.lua and deleted its specs.
  • Removed now-dead if not utils.is_markdown_buffer() then return end guards from multiple module enable() functions.
  • Cleaned up unused utils imports in modules that only used it for the removed helper.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/markdown-plus/utils_spec.lua Removes tests for the deleted is_markdown_buffer() utility.
lua/markdown-plus/utils.lua Deletes the deprecated is_markdown_buffer() export.
lua/markdown-plus/callouts/init.lua Removes redundant markdown-buffer guard in enable().
lua/markdown-plus/quote/init.lua Removes redundant markdown-buffer guard in enable().
lua/markdown-plus/list/init.lua Removes redundant guard and drops unused utils require.
lua/markdown-plus/links/init.lua Removes redundant markdown-buffer guard in enable().
lua/markdown-plus/images/init.lua Removes redundant markdown-buffer guard in enable().
lua/markdown-plus/headers/init.lua Removes redundant guard and drops unused utils require.
lua/markdown-plus/format/init.lua Removes redundant guard and drops unused utils require.
lua/markdown-plus/footnotes/init.lua Removes redundant guard and drops unused utils require.

end

---Safe string matching with nil check
---@param str? string String to match
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing utils.is_markdown_buffer() is a breaking change for any external code that still calls it via require('markdown-plus.utils'), even if it was previously marked deprecated. Consider keeping a temporary compatibility shim (returning true and emitting a deprecation warning) until the next major release.

Suggested change
---@param str? string String to match
---@param str string|nil String to match

Copilot uses AI. Check for mistakes.
@YousefHadder YousefHadder force-pushed the refactor/remove-deprecated-is-markdown-buffer branch from 6f2d998 to ed0f10e Compare February 8, 2026 18:07
@YousefHadder YousefHadder changed the title refactor: remove deprecated is_markdown_buffer utility refactor: deprecate is_markdown_buffer and remove dead-code callers Feb 8, 2026
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

Successfully merging this pull request may close these issues.

1 participant

Comments