macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.5k stars 681 forks source link

GitHub Copilot not operational within MacVim #1251

Closed krstp closed 2 years ago

krstp commented 2 years ago

Steps to reproduce

  1. Install GitHub Copilot for Vim (https://github.com/github/copilot.vim)
  2. Enable it within MacVim :Copilot enable
  3. Check status: :Copilot status, which should report enabled and online, instead it reports back the ghost text required neovim v.0.6, which is not exactly accurate. The same instance of underlying nvim (@0.7.2) in terminal window works with copilot as desired.

Expected behaviour

Functional GitHub Copilot within MacVim. Currently when typing the Copilot instead of displaying proposed code, instead reports function: syntax error

Version of Vim and architecture

VIM - Vi IMproved 8.2; NVIM v0.7.2

Environment

OS: MacOS Shell: zsh $TERM: xterm-256color Terminal: iTerm

How MacVim was installed

Binary download

Logs and stack traces

No response

Vim configuration where issue is reproducable

No response

Issue has been tested with given configuration

Issue has been tested with no configuration

Other conditions

eirnym commented 2 years ago

Does this plugin works with regular Vim installed from another source?

Please, Test with Vim 9 if possible

gainhad commented 2 years ago

The copilot plugin is only compatible with Neovim.

adudek16 commented 2 years ago

from https://github.com/github/copilot.vim "Copilot.vim is a Vim plugin for GitHub Copilot. For now, it requires Neovim 0.6 (for virtual lines support) and a Node.js installation." Agree, Not an macvim issue from what I see.

ychin commented 2 years ago

Yeah MacVim is a fork of Vim, not Neovim. You would need to use a Neovim GUI instead, e.g. Neovide, VimR, etc (I haven't used each much so can't really comment on their qualities).

Looking through the plugin, seems like they are saying they need Neovim for the virtual text support. I would imagine they could have supported regular Vim via popup windows (released in 8.2) if they wanted to, but may not have decided to spend the time. Looking through their code seems like they essentially only call nvim_buf_set_extmark and nvim_buf_del_extmark, and can easily replace those calls with Vim popup's. However, I don't have a subscription and will not be willing to pay for it to try it out so that's the extent of my digging (they say it is free for popular open-source software maintainers but MacVim is not considered as popular enough).

I would suggest just submitting a pull request to their plugin to add popup support (it actually seems quite manageable given the small amount of Neovim dependency they use) or just file a feedback. I would imagine they have incentives to support Vim if they want to compete with the likes of Tabnine.

krstp commented 2 years ago

Appreciate the insight. Much helpful. When I have time I will look into it more as well. Thanks!

qiqiboy commented 2 years ago

The latest patch(+patch 9.0.0162) of vim9 already support the virtual text feature, and Copilot.vim has also supported it in v1.5.0.

ychin commented 2 years ago

Well to be fair Vim's support for virtual text is not considered to ready for prime time yet as far as I understand.