News for hackers. Stuff that matters.
Re:Copilot Internals by gavinray on Sunday December 18, 2022 @12:19PM (#34039837)
I stumbled upon this repo by accident a few days ago when its source code appeared to contain the only usage the term "GH_COPILOT_TOKEN" in any repo on Github:

https://github.com/search?q=GH_COPILOT_TOKEN&type=code

(My Copilot was broken and this was in the error output I was seeing, see: https://github.com/community/community/discussions/41878)

What I found there was some truly impressive reverse-engineering work by a single individual. I really like the "JOURNAL" daily-diary they kept of progress and random thoughts so you could see the progression day-by-day.

--------

One thing I found interesting: The author says that it queries only the 20 recently most opened files of the same language.

But in an AMA, I asked about how much "context" Copilot has available, and one of the devs says it can, for example, read header files that pair with C/C++ files that are open in separate tabs:

https://github.com/orgs/community/discussions/29932#discussi...

  > "I assume Copilot uses the contents of the current project (IE, all files) as contextual information to offer suggestions. Is this the case?"

  > "Yes, copilot looks at what we call "related tabs", for example .c files are often paired with .h files, so copilot considers the contents of other tabs open in the editor to try to feed a more complete prompt to the model."
Re:Copilot Internals by thakkarparth007 on Monday December 19, 2022 @03:54AM (#34049952)
Hey Gavin, that's consistent with what I said in the blog post. Header files (.h) and (.c) files are classified as having the same language (C). As a result, if you have the header file open in a tab (or in the workspace -- I'm not sure if unaccessed files from workspace are used), then it'll be considered for the prompt.