liveBook · Manning

GitHub Copilot

As explained in Coding with AI

Copilot Chat is a conversational generative AI tool that answers questions and assists with software-related tasks across web, desktop, and mobile interfaces.

GitHub Copilot Chat is a conversational generative AI tool for software questions and coding tasks. It resembles ChatGPT and Google Gemini, but integrates with Microsoft software and offers web, desktop, and mobile interfaces. Its responses emphasize simple requests, search-like interaction, and agent mode for attempting tasks step by step. section 1.2.2

Inside Visual Studio Code, Copilot Chat acts as a coding assistant. Ask questions in plain English, paste the relevant code, and review the proposed revision rather than treating generated code as tested or optimized. section 2.5 section 2.5.2

Refactoring a Python file reader

A small Python project counts word frequencies in a Project Gutenberg text and displays the results in a bar chart. Copilot can suggest a file-reading function from its name, or improve an inefficient implementation after the prompt “How can I improve this code?” A clearer response uses a context manager, a descriptive variable, and a docstring; the developer still checks the result and may add an explicit UTF-8 encoding. section 2.5 section 2.5.2

A practical Copilot Chat workflow:

  • Describe one small programming task or name a function clearly to invite a focused suggestion. section 2.5.2
  • Paste imperfect code with a plain-English improvement request when refactoring is the goal. section 2.5.2
  • Compare alternatives for readability and efficiency, then test, understand, and revise the selected code. section 2.5.2
def read_text_file(file_path):
    with open(file_path, 'r') as f:
        return f.read()

A compact context-manager implementation illustrates the kind of file-reading function Copilot may suggest. section 2.5.2

How Coding with AI covers it

How deep it goes
Demonstrates prompts, suggestions, alternatives, and revisions in a Python task, but stops short of guaranteeing optimization, testing, or validation.
Examples
Uses a Python word-frequency application, Project Gutenberg text, file-reading suggestions, and refactoring prompts as concrete examples.
What it assumes
Assumes basic Python and Visual Studio Code familiarity, while teaching the Copilot-assisted workflow through a small project.
What you can do after
Apply it via Visual Studio Code to generate or refactor small Python functions while evaluating and validating every suggestion.
How it connects
Connects generative AI with Visual Studio Code, Python, code completion, prompt engineering, and software tools such as ChatGPT and Google Gemini.

Also explained in

Compare how 5 books explain GitHub Copilot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Coding with AI. The section links point to the parts of the book it draws on.