bug: doesn't attach when buffer has multiple filetypes, including one supported

未关闭 适合新手
#715 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
lua
领域
tooling

调研方向

首先阅读 issue 指出的 lua/render-markdown/core/manager.lua 第 150 行附近的文件类型比较代码。检查缓冲区的文件类型如何与配置的文件类型进行比较;当文件类型为 markdown.Avante 的缓冲区被识别为包含 markdown,且插件启用时,即为完成。

由索引模型根据 Issue 内容生成。

描述

bug
Neovim version (nvim -v)

0.12.6

Neovim distribution

N/A

Operating system

nixos

Terminal emulator / GUI

kitty

Describe the bug

in https://github.com/avante-corp/avante.nvim, I want to assign the buffer multiple filetypes with set ft=markdown.Avante, as supported by vim ( see :h ft "When a dot appears in the value then this separates two filetype names, it should therefore not be used for a filetype. ").
This plugin does an exact string compareason at https://github.com/MeanderingProgrammer/render-markdown.nvim/blob/8e8795368391036643b622875a6da6a51bcd33f4/lua/render-markdown/core/manager.lua#L150 which fails when it compares "markdown" with "markdown.Avante". So render-markdown is not enabled while it should.

I believe nvim_get_option_value should return an array for "ft" but until it does, render-markdown could split the return filetypes on . and compare those

Expected behavior

avante should detect that ft contains the "markdown" and be enabled.

Healthcheck output
it's all green
Plugin configuration
require('render-markdown').setup({
    -- enabled = true,
    -- debounce = 100,
    log_level = 'error',
    log_runtime = false,
    -- to appease checkhealth
    html = { enabled = false },
    -- use recommended settings from above
    file_types = { 'markdown', 'Avante',
        -- 'markdown.Avante'  -- workaround
},
})
Plugin error log
empty
Confirmations
  • I have updated this plugin to the latest version using my plugin manager
  • I have updated all treesitter parsers (:TSUpdate)
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.
Additional information

No response

主要语言
Lua
星标
5.2k
派生
152
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

MeanderingProgrammer/render-markdown.nvim 的其他 Issue

查看 MeanderingProgrammer/render-markdown.nvim 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。