Last year, Microsoft’s GitHub launched GitHub Copilot, an AI-powered pair programmer. GitHub Copilot can suggest the next line of code when you type code or comments. GitHub Copilot can even suggest complete methods, boilerplate code, unit tests, and even complex algorithms. Even though the code is suggested by AI, some developers were interested to know whether the AI suggested code matches any publicly available code. Last November, GitHub Copilot introduced a feature that allowed developers to block suggestions of 150+ characters matching public code.
Yesterday, GitHub introduced a private beta of GitHub Copilot with code referencing that includes an updated filter which detects and shows context of code suggestions matching public code on GitHub. When this new feature is enabled, GitHub Copilot will check code suggestions with surrounding code of about 150 characters and compare it against the public code available on GitHub.com. If there is a match, Copilot will provide the following information:
- The matching code
- The repositories where that code appears
- The license governing each repository
“By helping developers understand the community context of their code in a manner that also preserves developer flow, we believe Copilot will continue to deliver responsible innovation and true happiness at the keyboard,” wrote Ryan J. Salva of GitHub in the announcement blog post.