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

Errors on each keypress when offline #165

Open
divan opened this issue May 6, 2023 · 9 comments
Open

Errors on each keypress when offline #165

divan opened this issue May 6, 2023 · 9 comments

Comments

@divan
Copy link

divan commented May 6, 2023

When there is no internet connection available, plugin seems to throw error on each keypress:

RPC[Error] code_name = InternalError, message = "Request getCompletions failed with message: getaddrinfo ENOTFOUND api.github.com"

This seems to be described in #93, but suggested solution is disable auto trigger of Copilot. This might be an option for some people, but I prefer it to be enabled by default, just don't show error when this error is encountered.

The problem is particularly nasty as this error prevents from normal typing – I need to press Enter to dismiss an error and then type the next character. Basically it makes typing impossible without internet.

Any idea how to prevent it from throwing an error?

I'm using Astronvim, not sure if the behaviour of the plugin is the same for all nvim configurations. Could anyone verify if they having the same behaviour?

@MunifTanjim
Copy link
Collaborator

Just disable it? :Copilot disable

@divan
Copy link
Author

divan commented May 6, 2023

Just disable it? :Copilot disable

Actually it took some time and googling to even find that this issue is caused by Copilot. As I used Astronvim, my initial thought was that it's some git(hub) plugin I'm unaware about. Nothing in the error messages hints to Copilot.

Disabling and enabling back everytime you're on the bad network or without network is a workaround, but not really a solution. There is no reason to throw this error at all (I kinda expect that Copilot won't work without internet, it's expected, no error to react here). Errors should be thrown only when app want's human to intervene and do something. Otherwise it should just fail silently. Definitely not to disrupt a core functionality of the editor.

@MunifTanjim
Copy link
Collaborator

Weirdly, if I disconnect my network, I get these in the ~/.local/state/nvim/lsp.log file:

[ERROR][2023-05-07 22:19:53] .../vim/lsp/rpc.lua:734	"rpc"	"node"	"stderr"	"[ERROR] [default] [2023-05-07T16:19:53.216Z] Request Error: The pending stream has been canceled (caused by: getaddrinfo ENOTFOUND copilot-proxy.githubusercontent.com)\n"
[ERROR][2023-05-07 22:19:53] .../vim/lsp/rpc.lua:734	"rpc"	"node"	"stderr"	"[ERROR] [ghostText] [2023-05-07T16:19:53.217Z] Error on ghost text request FetchError: The pending stream has been canceled (caused by: getaddrinfo ENOTFOUND copilot-proxy.githubusercontent.com)\n"
[ERROR][2023-05-07 22:19:57] .../vim/lsp/rpc.lua:734	"rpc"	"node"	"stderr"	"ApplicationInsights:Sender [\n  'Ingestion endpoint could not be reached. This batch of telemetry items has been lost. Use Disk Retry Caching to enable resending of failed telemetry. Error:',\n  [\n    \"[object Error]{ stack: 'Error: getaddrinfo ENOTFOUND copilot-telemetry.githubusercontent.com\\n\" +\n      \"    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)', message: 'getaddrinfo ENOTFOUND copilot-telemetry.githubusercontent.com', name: 'Error'\"\n  ]\n]\n"

But neovim doesn't print any error in the cmdline. So it doesn't interrupt text insertion.

Can you share how you're setting up lsp and copilot?

@MunifTanjim
Copy link
Collaborator

Also what's the output of :Copilot version?

@divan
Copy link
Author

divan commented May 7, 2023

@MunifTanjim hmm, I checked my lsp.log and it's same as yours upon going offline. But here is a bit more weirdness to the story:

When I try to reproduce it on the external monitor or with a small enough font – there is no error thrown. But once I use larger font size (and/or laptop display) – then it appears. Literally by changing terminal font size the issue appears or disappears.

Screenshot 2023-05-07 at 20 14 41

It's probably has something to do how Astronvim handles errors display, but as I'm not nvim power use, I have no idea where to even look at.

Also what's the output of :Copilot version?

copilot.vim 1.8.4
copilot.lua 8b0fd23747ef82154ef9f919c75623156465cc89
copilot/dist/agent.js 1.84.0
Node.js 20.0.0

@MunifTanjim
Copy link
Collaborator

Also what's the output of :Copilot version?

copilot.vim 1.8.4
copilot.lua 8b0fd23747ef82154ef9f919c75623156465cc89
copilot/dist/agent.js 1.84.0
Node.js 20.0.0

Usually that output also contains neovim's version 🤔 What's the version of Neovim you're using?

@divan
Copy link
Author

divan commented May 9, 2023

@MunifTanjim

:version

NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.0/share/nvim"

@Bekaboo
Copy link

Bekaboo commented Dec 5, 2023

Any workaround for this? The error message is quite annoying when you have slow internet connection. I would rather just hide the message.

@teocns
Copy link

teocns commented Dec 23, 2023

I think you can write up an autocmd that suppresses outputs for the copilot plugin, but besides :Copilot disable I think there's no workaround atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants