Github Copilot is Magic

Just look at this thing. I’m completely astounded at its capabilities.

Github Copilot suggesting the correct test assertion

  1. It knows that I’m writing a test and that my assertion library uses the Should() extension method
  2. It knows that I’m testing an HTTP Basic Auth function
  3. It knows that HTTP Basic auth uses the Authorization header
  4. It knows that header has the Basic scheme
  5. It knows that the second part of that header is a base64 encoded value
  6. It finds "matt:password" in the code and realizes thats probably what needs encoding
  7. It executes the base64 encoding routine and suggests it

I understand that AI doesn’t really “know” anything, and that its all pattern matching at the end of the day. But stuff like this still feels legitimately intelligent. Did some github engineer add a base64 encoding routine? Or is pattern matching good enough to work out how base64 encoding works just from seeing a gazillion lines of colon-separated strings and the corresponding encoded gibberish?

I didn’t believe that it could actually execute a base64 encoding and had to check it, but sure enough it did it exactly right. I expected it to just find some random string from some other developers github project with a test authorization header. But nope, it’s actually correct:

> atob("bWF0dDpwYXNzd29yZA==")