About Copilot code referencing in JetBrains IDEs
如果允许与公共代码匹配的建议,则 GitHub Copilot 可以提供建议匹配的代码的详细信息。 在以下情况下会发生此情形:
- 在编辑器中接受代码完成建议时。
- 当 Copilot Chat 中的响应包括匹配代码时。
Code referencing for Copilot code completion
如果接受与 GitHub 公共存储库中的代码匹配的代码补全建议,则会记录有关该匹配代码的信息。 该日志条目包括包含匹配代码的文件的 URL,以及适用于该代码的许可证名称(如果有)。 这使你可以查看这些引用并决定如何继续。 例如,可以决定要使用的属性,或者是否要从项目中移除此代码。
注意
- 系统仅为已接受的 Copilot 建议的匹配项进行代码引用(以完成代码)。 不会检查你编写的代码和你修改的 Copilot 建议是否与公共代码匹配。
- 通常,与公共代码匹配的几率不到 Copilot 建议的 1%,因此不要期望看到许多建议的代码引用。
Code referencing for Copilot Chat
当 Copilot Chat 提供的响应包含与 GitHub 公共仓库中的代码匹配的代码时,响应末尾将显示一个链接,单击该链接可以在编辑器中查看匹配的代码的详细信息。
About Copilot code referencing in Visual Studio Code
如果允许与公共代码匹配的建议,则 GitHub Copilot 可以提供建议匹配的代码的详细信息。 在以下情况下会发生此情形:
- 在编辑器中接受代码完成建议时。
- 当 Copilot Chat 中的响应包括匹配代码时。
Code referencing for Copilot code completion
如果接受与 GitHub 公共存储库中的代码匹配的代码补全建议,则会记录有关该匹配代码的信息。 该日志条目包括包含匹配代码的文件的 URL,以及适用于该代码的许可证名称(如果有)。 这使你可以查看这些引用并决定如何继续。 例如,可以决定要使用的属性,或者是否要从项目中移除此代码。
注意
- 系统仅为已接受的 Copilot 建议的匹配项进行代码引用(以完成代码)。 不会检查你编写的代码和你修改的 Copilot 建议是否与公共代码匹配。
- 通常,与公共代码匹配的几率不到 Copilot 建议的 1%,因此不要期望看到许多建议的代码引用。
Code referencing for Copilot Chat
当 Copilot Chat 提供的响应包含与 GitHub 公共仓库中的代码匹配的代码时,响应末尾将显示一个链接,单击该链接可以在编辑器中查看匹配的代码的详细信息。
About Copilot code referencing on GitHub.com
If you, or your organization, have allowed suggestions that match public code, then whenever a response from Copilot Chat includes matching code, details of the matches will be included in the response.
注意
Typically, matches to public code occur infrequently, so you should not expect to see code references in many Copilot Chat responses.
About Copilot code referencing in Visual Studio
如果允许与公共代码匹配的建议,则 GitHub Copilot 可以提供建议匹配的代码的详细信息。 在以下情况下会发生此情形:
- 在编辑器中接受代码完成建议时。
- 当 Copilot Chat 中的响应包括匹配代码时。
Code referencing for Copilot code completion
如果接受与 GitHub 公共存储库中的代码匹配的代码补全建议,则会记录有关该匹配代码的信息。 该日志条目包括包含匹配代码的文件的 URL,以及适用于该代码的许可证名称(如果有)。 这使你可以查看这些引用并决定如何继续。 例如,可以决定要使用的属性,或者是否要从项目中移除此代码。
注意
- 系统仅为已接受的 Copilot 建议的匹配项进行代码引用(以完成代码)。 不会检查你编写的代码和你修改的 Copilot 建议是否与公共代码匹配。
- 通常,与公共代码匹配的几率不到 Copilot 建议的 1%,因此不要期望看到许多建议的代码引用。
Code referencing for Copilot Chat
When Copilot Chat provides a response that includes code that matches code in a public GitHub repository, this is indicated below the suggested code, with a link to display details of the matched code in the output log.
How code referencing finds matching code
Copilot code referencing compares potential code suggestions and the surrounding code of about 150 characters against an index of all public repositories on GitHub.com.
Code in private GitHub repositories, or code outside of GitHub, is not included in the search process.
Limitations
The search index is refreshed every few months. As a result, newly committed code, and code from public repositories deleted before the index was created, may not be included in the search. For the same reason, the search may return matches to code that has been deleted or moved since the index was created.
References to matching code are currently available in JetBrains IDEs, Visual Studio, Visual Studio Code, and on the GitHub website.