Key Points
Introduction to AI Coding IDE Tools
- AI coding tools are evolving rapidly and range from inline suggestions and chat to agentic workflows with varying levels of autonomy.
- Generative AI systems are typically optimised for likelihood, not accuracy.
- IDE coding assistants can help generate, explain, refactor, debug, document and test code.
- AI-generated code can be plausible but confidentally incorrect, insecure or unsuitable for research
- Researchers remain responsible for reviewing and validating outputs from generative AI.
- Consider privacy, security, bias and vendor lock-in, and avoid accumulating technical debt through unreviewed quick fixes.
- GitHub Copilot integrates into VSCode to provide suggestions and chat, using prompts and relevant context sent to cloud services.
- Generative AI models each have different strengths and tradeoffs.
- A model harness provides the surrounding context, tools, guardrails and feedback.
- The Copilot free tier has a limited selection of models and monthly quotas of 2000 inline completions and 50 premium requests.
Introduction to Microsoft Visual Studio Code
- Integrated Development Environments (IDEs) are all-in-one tools for writing, editing, testing, and debugging code, improving developer efficiency by reducing the need to switch between different applications
- Virtual environments are used to contain dependencies specific to a particular code project
- Key VSCode features are accessible via the left navigation bar and the menu
- VSCode’s capabilities can be increased by installing extensions
- A VSCode “workspace” is a project that consists of a collection of folder and files
- Git source code repositories on GitHub can be cloned locally and opened from within VSCode
- Syntax highlighting gives you immediate feedback of potential issues as you write code
- Code completion helps to automatically finish incomplete code statements and names
- Run a script by selecting the “Play” icon in VSCode
- Output from running a Python script is displayed in the interactive “console” or “terminal”
Getting Started with using Copilot within VSCode
- Copilot’s capabilities are added to VSCode by installing two plugins, GitHub Copilot and GitHub Copilot chat.
- Consider and configure the level of privacy for Copilot by configuring it within your account at GitHub’s website.
- Generally, it’s recommended to disable
Suggestions matching public codeat a minimum to avoid it making use of public code sources in a way that isn’t properly licensed. - Copilot has three modes of operation: Ask, Edit and Agent, each delegating a higher degree of autonomy to Copilot.
- Due to the way LLMs process requests, responses based on the same question will likely show differences.
- To write a good chat response, be specific and add as much context as possible.
- Add context to a prompt by including
#followed by the context, e.g.#inflammation-plot.pyor#codebase'. - Personalise Copilot’s context by creating an
.github/copilot-instructions.mdfile. - Due to the way LLMs work, there is no “rationale” behind Copilot’s responses.
- Check Copilot’s usage for inline suggestions and chat messages within your current tier by selecting it’s icon in the status bar.
How to use Copilot to Improve an Existing Codebase
- Inline suggestions are made by Copilot as “ghosted text” in the
editor which you autocomplete with the
Tabkey. - Copilot can suggest small-scale modifications for your approval
based on a segment of code by selecting the code and using
Editmode in the chat window (or pressingCtrl + IorCmd/Windows Key + I) and entering a request. - Always review and never blindly accept AI-generated code suggestions.
- Copilot can write summary Git commit messages for us in VSCode by
selecting the sparkle icon next to the commit message text box in the
Source controlnavigation tab. - Agent mode can suggest larger-scale modifications to our code across
multiple files by using
Agentmode in the chat window, and entering a more comprehensive and complex request. - Select
Retryto have Copilot re-generated a response. - It’s important to consider how to include AI-based coding assistants in your day-to-day development process to ensure accountability, quality, and sustainability are maintained within a codebase.
- Skills in VSCode Copilot are reusable instructions and resources that guide Copilot through specific tasks.
Investigate a New Codebase
- Build an array of useful reusable prompts to accomplish specific tasks related to software development.
- Review their usefulness and improve them over time.