Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaSnip source: extended filetypes are not honored #603

Closed
2 tasks done
SuzumiK opened this issue Dec 16, 2024 · 1 comment
Closed
2 tasks done

LuaSnip source: extended filetypes are not honored #603

SuzumiK opened this issue Dec 16, 2024 · 1 comment
Labels
bug Something isn't working sources Specific source provider or the system as a whole

Comments

@SuzumiK
Copy link
Contributor

SuzumiK commented Dec 16, 2024

Make sure you have done the following

  • I have updated to the latest version of blink.cmp
  • I have read the README

Bug Description

In LuaSnip, it is possible to extend snippets for file types with snippets from other file types, eg. ls.filetype_extend("python", { "all" }) to enable all snippets for python. Currently, the blink LuaSnip source does not pick up on these extensions because ls.get_snippets(ft) does not follow extensions. cmp_luasnip solves this by first fetching relevant snippet filetypes and then iterating over all of them: https://github.com/saadparwaiz1/cmp_luasnip/blob/98d9cb5c2c38532bd9bdb481067b20fea8f32e90/lua/cmp_luasnip/init.lua#L67

Relevant configuration

{
  'saghen/blink.cmp',
  version = 'v0.*', 
  dependencies = '{ L3MON4D3/LuaSnip', version = 'v2.*' },
  opts = {
    snippets = {
      expand = function(snippet) require('luasnip').lsp_expand(snippet) end,
      active = function(filter)
        if filter and filter.direction then
          return require('luasnip').jumpable(filter.direction)
        end
        return require('luasnip').in_snippet()
      end,
      jump = function(direction) require('luasnip').jump(direction) end,
    },
    sources = {
      completion = {
        enabled_providers = { 'lsp', 'path', 'luasnip', 'buffer' },
      },
    },
  }
}

neovim version

nightly

blink.cmp version: branch, tag, or commit

v0.7.6

@SuzumiK SuzumiK added the bug Something isn't working label Dec 16, 2024
@Saghen
Copy link
Owner

Saghen commented Dec 16, 2024

Ah, that would also remove the need for global_snippets if I'm not mistaken. Pr is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sources Specific source provider or the system as a whole
Projects
None yet
Development

No branches or pull requests

2 participants