Search code examples
pythonarchlinuxneovimgithub-copilot

GitHub Coptilot does not work in NeoVim when editing Python


I have Arch Linux and so the latest NeoVim release is installed (0.7.0 at this moment). About a month I started using GitHub Copilot and it worked well in Bash, SH, JS and others. Yesterday I wanted to rewrite some program in Python but Copilot didn't work. Tried it in different files and languages - works everywhere but not Python! :Copilot status shows "Copilot: Enabled and online", but gives no suggestions. :Copilot panel shows "Synthesizing 0/10 solutions (Duplicates hidden)". :Copilot log contains nothing. I remember that some time ago it worked as expected but now it does not. I don't have any ideas why is that happening. As an Arch user I reject VisualStudio Code and other IDEs and prefer working in terminal. Anything that may help?

Edit: just discovered that opening a file without .py and printing #!/usr/bin/env python3 works for Copilot, but in this case there's no syntax highlight. Reopening with :edit adds colors but breaks Copilot


Solution

  • I've just solved it on my machine. I used nvm to set my NodeJS back to v16.13.0. reloaded neovim. Copilot now working as expected.

    Copilot was not working on NodeJS v18.0.0.

    What's annoying is tim-pope doesn't have the issues section active on the repo. So I'm sure others will run into this. Let me know if this solves it for you.