Ends in
00
days
00
hrs
00
mins
00
secs
ENROLL NOW

🎊 Black Friday is here! Enjoy up to 30% OFF ALL AWS Associate-Level Courses!

GitHub Copilot Completions

Home » Others » GitHub Copilot Completions

GitHub Copilot Completions

GitHub Copilot Completions Cheat Sheet

GitHub Copilot’s completions encompass key features, including Code Suggestions, Text Completion, and Code Referencing. Each section explains how these features work, their controls, best practices, and examples to help you maximize their utility.

Code Suggestions

Code Suggestions are the heart of GitHub Copilot. As you type in your Integrated Development Environment (IDE), Copilot offers intelligent code completions based on the context of your code, helping you write code faster and with fewer errors.

How It Works

  • Copilot analyzes the context of your code, including functions, variables, and libraries, to provide relevant code suggestions.
  • You can also prompt Copilot with natural language comments (e.g., // function to reverse a string), and it will suggest corresponding code.

Key Controls & Behaviors

Action  

Behavior

Accept Full Suggestion 

Press Tab (or configured key) to insert the suggestion.

Accept Partial Suggestion 

Accept individual words or lines using Tab or other IDE shortcuts.

Cycle Through Suggestions 

Use keyboard shortcuts (e.g., Option/Alt + ] or [) to cycle through alternate suggestions.

Open Suggestion Panel 

Use Ctrl + Enter (Windows) / Cmd + Shift + A (macOS) to view multiple suggestions.

Dismiss Suggestion 

Press Esc or continue typing to dismiss the suggestion.

GitHub Copilot Code Suggestions

Supported Languages

  • Python
  • JavaScript/TypeScript
  • Ruby
  • Go
  • C#
  • C++

Public Code Matching & Policies

  • Copilot may suggest code that matches publicly available code. You can configure whether to allow or block these suggestions through GitHub settings.

  • For private repositories, suggestions are not based on your private code unless explicitly configured.

Tutorials dojo strip

Best Practices

  • Providing detailed comments or method signatures helps guide Copilot in generating more accurate suggestions.

  • Always check the generated code for correctness, style, and security before using it.

  • To avoid suggestions that match public code, enable the setting to block them.

Text Completion

Text Completion helps you write and auto‑complete written content, such as pull request descriptions or issue comments, using the context of your project.

How It Works

  • PR Descriptions: As you write a pull request description, Copilot suggests ways to complete sentences based on the files changed, issues referenced, and the context of the PR.

  • Issue and Comment Generation: Copilot also helps generate text for issues or comments related to your code.

GitHub Copilot Text Completion

Limitations

  • Currently, text completion is only available for English content.

  • Public Preview: This feature is currently in public preview and may undergo changes over time.

  • Not Always Accurate: Text completion is most effective when starting fresh (e.g., new PRs) rather than editing pre‑existing descriptions.

Best Practices

  • Provide Clear Context: The more context you provide (e.g., file changes, referenced issues), the better the suggestions will be.

  • Review Suggestions: Always review the text to ensure it aligns with your style and organizational guidelines.

Code Referencing

Code Referencing identifies when Copilot suggests code that matches public code. This is useful for ensuring compliance with open-source licenses and understanding the origin of the proposed code.

How It Works

  • Public Code Matching: Copilot checks the suggestions it provides against publicly available code repositories on GitHub. If a match is found, Copilot delivers a link to the original code and its associated license.

  • Attribution: If a suggestion matches public code, Copilot includes the URL of the matched repository and the license type (e.g., MIT, GPL).

Policy & Settings

  • Enable/Disable Public Code Matching: You can configure GitHub Copilot to either allow or block suggestions that match public code. This setting helps ensure your project remains compliant with licensing requirements.

  • Audit Logs: If you enable code referencing, you can review logs to track the instances where public code is referenced.

Best Practices

  • Review Public Code Matches: When Copilot suggests public code, ensure it aligns with your project’s licensing requirements.

  • Attribution & License Review: When using public code, ensure that you provide proper attribution and verify the license is compatible with your project.

CONCLUSION

GitHub Copilot is a powerful tool that significantly enhances productivity by offering intelligent code suggestions, text completions, and code referencing. Analyzing the context of your code and providing context-aware suggestions enables developers to write code more efficiently and with fewer errors.

To get the most out of Copilot, it is essential to:

  • Use detailed comments and method signatures to guide the tool towards generating more accurate code completions.

  • Be vigilant in reviewing suggestions for correctness, style, and security, especially when dealing with public code matching.

  • Leverage text completion for generating pull request descriptions and comments, ensuring clear context is provided to maximize suggestion relevance.

  • Regularly review public code references to maintain compliance with open-source licensing requirements and ensure proper attribution.

While GitHub Copilot is an invaluable assistant for developers, it is crucial to review its suggestions and configurations (such as blocking public code matches when necessary) to ensure that they meet project requirements and adhere to best practices.

REFERENCES

https://docs.github.com/en/copilot/concepts/completions/code-suggestions

https://docs.github.com/en/copilot/concepts/completions/text-completion

https://docs.github.com/en/copilot/concepts/completions/code-referencing

🎊 Black Friday is here! Enjoy up to 30% OFF ALL AWS Associate-Level Courses!

Tutorials Dojo portal

Learn AWS with our PlayCloud Hands-On Labs

🧑‍💻 CodeQuest – AI-Powered Programming Labs

FREE AI and AWS Digital Courses

Tutorials Dojo Exam Study Guide eBooks

tutorials dojo study guide eBook

FREE AWS, Azure, GCP Practice Test Samplers

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

Join Data Engineering Pilipinas – Connect, Learn, and Grow!

Data-Engineering-PH

Ready to take the first step towards your dream career?

Dash2Career

K8SUG

Follow Us On Linkedin

Recent Posts

Written by: Ace Kenneth Batacandulo

Ace is AWS Certified, AWS Community Builder, and Cloud Consultant at Tutorials Dojo Pte. Ltd. He is also the Co-Lead Organizer of K8SUG Philippines and a member of the Content Committee for Google Developer Groups Cloud Manila. Ace actively contributes to the tech community through his volunteer work with AWS User Group PH, GDG Cloud Manila, K8SUG Philippines, and Devcon PH. He is deeply passionate about technology and is dedicated to exploring and advancing his expertise in the field.

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

~98%
passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
200k+
students
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
~4.8
ratings
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?