hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.47k stars 370 forks source link

Confirming html snippet doubles the first character "<" #1757

Open w4ff3l opened 7 months ago

w4ff3l commented 7 months ago

FAQ

Announcement

Minimal reproducible full config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'

Plug 'L3MON4D3/LuaSnip'
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'rafamadriz/friendly-snippets'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
local luasnip = require "luasnip"

cmp.setup {
  snippet = {
    expand = function(args)
    luasnip.lsp_expand(args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = cmp.config.sources({
    { name = 'luasnip' },
  }),
}

EOF

lua << EOF
local loader = require "luasnip.loaders.from_vscode"
loader.load { }
EOF

Description

Using cmp, LuaSnip and friendly-snippets with html files leads to doubled character at the start of the snippet.

Steps to reproduce

Expected behavior

<h1></h1>

Actual behavior

<<h1></h1>

asciicast

Additional context

No response

markmartirosian commented 4 months ago

Any workarounds?