Skip to content

bug: attempts to load cmp integration when only blink is installed #298

@raph-rc

Description

@raph-rc

Neovim version (nvim -v)

0.11.0-dev+1551-ge8ddb7a46

Neovim distribution

N/A

Operating system

Fedora 41

Terminal emulator / GUI

Ghostty

Describe the bug

When render-markdown is enabled, the following error comes up:

vim/_editor.lua:0: Autocommandes BufReadPost pour "*"..Autocommandes FileType pour "markdown"..script nvim_exec2() called at Autocommandes FileType pour "markdown":0../home/raphrc/.local/share/nvim/lazy/render-markdown.nvim/plugin/render-markdown.lua: Vim(source):E5113: Error while calling lua chunk: ...y/render-markdown.nvim/lua/render-markdown/integ/cmp.lua:38: attempt to call field 'register_source' (a nil value)
stack traceback:
	...y/render-markdown.nvim/lua/render-markdown/integ/cmp.lua:38: in function 'setup'
	...vim/lazy/render-markdown.nvim/plugin/render-markdown.lua:10: in main chunk
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function 'cmd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:510: in function <...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:509>
	[C]: in function 'xpcall'
	.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:135: in function 'try'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:509: in function 'source'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:457: in function 'source_runtime'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:425: in function 'packadd'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:359: in function '_load'
	...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:197: in function 'load'
	...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:85: in function <...hare/nvim/lazy/lazy.nvim/lua/lazy/core/handler/event.lua:72>
	[C]: in function 'nvim_cmd'
	/usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
	[C]: in function 'pcall'
	vim/shared.lua: in function <vim/shared.lua:0>
	[C]: in function '_with'
	/usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - /usr/share/nvim/runtime/filetype.lua:36
  - vim/shared.lua:0
  - /usr/share/nvim/runtime/filetype.lua:35

I do not have nvim_cmp installed, and am only trying to load the blink.cmp integration. However, it seems that the plugin loads as expected and the rendering is unaffected.

Expected behavior

There is no error. Disabling the autocommand should do it, but I am not sure how to do that.

Healthcheck output

==============================================================================
render-markdown:                     require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 7.8.6
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [nvim-treesitter] ~
- OK installed
- OK markdown: parser installed
- OK markdown: highlight enabled
- OK markdown_inline: parser installed
- OK markdown_inline: highlight enabled
- OK latex: parser installed

render-markdown.nvim [icons] ~
- OK using: mini.icons

render-markdown.nvim [executables] ~
- WARNING latex2text: not installed
  - ADVICE:
    - Disable LaTeX support to avoid this warning by setting { latex = { enabled = false } }

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK obsidian: not installed



### Plugin configuration

```lua
render-markdown config

  {
    "MeanderingProgrammer/render-markdown.nvim",
    dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" },
    ---@module 'render-markdown'
    ---@type render.md.UserConfig
    ft = { "markdown" },
    opts = {
      enabled = true,
    },
    config = function(_, opts)
      require("render-markdown").setup(opts)
    end,
  },

Blink.cmp config:

  {
    "saghen/blink.cmp",
    -- optional: provides snippets for the snippet source
    dependencies = "rafamadriz/friendly-snippets",

    -- use a release tag to download pre-built binaries
    version = "*",

    ---@module 'blink.cmp'
    ---@type blink.cmp.Config
    opts = {
      -- 'default' for mappings similar to built-in completion
      -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
      -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
      -- See the full "keymap" documentation for information on defining your own keymap.
      keymap = { preset = "default" },

      appearance = {
        use_nvim_cmp_as_default = true,
        nerd_font_variant = "mono",
      },

      sources = {
        default = { "lsp", "path", "snippets", "buffer", "markdown" },
        providers = {
          markdown = {
            name = "RenderMarkdown",
            module = "render-markdown.integ.blink",
            fallbacks = { "lsp" },
          },
        },
      },
    },
    opts_extend = { "sources.default" },
  },


### Plugin error log

```text
N/A

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions