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

completion on the whitescope with copliot-cmp result in a broken experience #1533

Closed
2 tasks done
kulabun opened this issue Apr 24, 2023 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@kulabun
Copy link
Contributor

kulabun commented Apr 24, 2023

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

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 'zbirenbaum/copilot.lua'
Plug 'zbirenbaum/copilot-cmp'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" vim.cmd([[set completeopt=menu,menuone,noselect]])

" Setup global configuration. More on configuration below.
lua << EOF
  local cmp = require "cmp"
  cmp.setup {
    mapping = {
      ['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace })
    },

    sources = cmp.config.sources({
      { name = "copilot" },
    }),
  }
EOF

lua << EOF
  local copilot = require "copilot"
  copilot.setup({
    suggestion = { enabled = false },
    panel = { enabled = false },
  })
  local copilot_cmp = require "copilot_cmp"
  copilot_cmp.setup({})
EOF

Description

When copilot is used in the beginnig of the line after indentation, resulted completion is a not what expected. It looks broken.

It looks like this is happening because of whitespace handling in cmp and '.' keyword pattern that can trigger completion on the whitespace.

Steps to reproduce

write some comment or class statement in the first line. Move cursor to the second line add two whitespaces / tabs.

Expected behavior

You get completion you accepted.

Actual behavior

some part of the completion is duplicated in the beginning of the inserted text.

Additional context

No response

@kulabun kulabun added the bug Something isn't working label Apr 24, 2023
kulabun added a commit to kulabun/nvim-cmp that referenced this issue Apr 24, 2023
kulabun added a commit to kulabun/nvim-cmp that referenced this issue Apr 26, 2023
kulabun added a commit to kulabun/nvim-cmp that referenced this issue Apr 26, 2023
@hrsh7th
Copy link
Owner

hrsh7th commented Apr 26, 2023

Thank you. I'll check your PR and the issue.

@CharlesARoy
Copy link

This sounds like an issue I'm having that I described over on the copilot-cmp page. For me, it hasn't been fixed yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants