refactor: deprecate is_markdown_buffer and remove dead-code callers#206
Open
YousefHadder wants to merge 1 commit intomainfrom
Open
refactor: deprecate is_markdown_buffer and remove dead-code callers#206YousefHadder wants to merge 1 commit intomainfrom
YousefHadder wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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()fromlua/markdown-plus/utils.luaand deleted its specs. - Removed now-dead
if not utils.is_markdown_buffer() then return endguards from multiple moduleenable()functions. - Cleaned up unused
utilsimports 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 |
There was a problem hiding this comment.
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 |
6f2d998 to
ed0f10e
Compare
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
Deprecate
utils.is_markdown_buffer()(which always returnstrue) with avim.deprecate()warning targeting removal in 2.0.0. Filetype filtering is handled by the autocmd pattern ininit.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
vim.deprecate()call tois_markdown_buffer()inutils.luaenable()functions: callouts, format, footnotes, list, links, images, quote, headersutilsimports from 4 modules that only used it for this functionutils_spec.lua(the function is deprecated, not tested)