Overseas access: www.kdjingpai.com
Ctrl + D Favorites

GitHub Copilot Chat is a Visual Studio Code (VS Code) extension developed by Microsoft. It provides developers with code-related help through artificial intelligence. Users can ask questions in natural language to get code suggestions, explanations and optimizations. The tool is powered by GitHub Copilot and is suitable for both individual and team developers. It gives precise answers based on the context of the code and reduces the time spent looking at documentation. Users need to have a GitHub account and can use it through the free or subscription plan. The extension is easy to install and has a user-friendly interface that is suitable for various programming scenarios.

GitHub Copilot Chat:微软开源VS Code辅助AI编程工具-1

 

Function List

  • Code Completion: Automatically generate code suggestions based on the current code context.
  • Natural Language Chat: Supports asking questions in natural language to get code-related answers.
  • Code editing suggestions: provide code optimization, bug fixes and refactoring suggestions.
  • Intelligent Contextual Analysis: Provides precise programming assistance based on code files and variables.
  • Cross-file editing: Apply code changes in multiple files, suitable for complex tasks.
  • Agent Mode: Automates multi-step programming tasks and handles compilation and testing issues.
  • Inline Chat: Interact directly with Copilot in the editor to keep your work flowing.

 

Using Help

Installation process

  1. preliminary
    Make sure you have the latest version of Visual Studio Code installed (VS Code Insiders is recommended for the latest features). A GitHub account is required, and make sure the account has the GitHub Copilot Free Plan or Subscription Plan activated. The free plan provides 2000 code completions and 50 chat requests per month. For more features, upgrade to a paid plan, available on the GitHub website.
  2. Installation of extensions
    • Open VS Code and go to the extensions panel (shortcut) Ctrl+Shift+X maybe Cmd+Shift+X).
    • Type in the search field GitHub Copilot ChatThe
    • Find the extension published by Microsoft and click "Install".
    • After installation, click the "Sign in" button to authorize your GitHub account. If you encounter authentication problems, you can refer to the GitHub website'sSupport PageThe
  3. Enabling extensions
    • After successful installation, the Copilot Chat icon will appear in the VS Code sidebar. Click on it to open the chat panel.
    • To enable Agent mode, go to VS Code Settings and search for Copilot ChatIf you want to enable Agent Mode, check "Enable Agent Mode".

Functional operation flow

1. Code completion

Enter code in the code editor and Copilot Chat will automatically suggest subsequent code snippets. For example, type function calculateSum After that, Copilot may suggest the complete function body:

function calculateSum(a, b) {
return a + b;
}

check or refer to Tab key to accept the suggestion, or press the Esc key is ignored. Suggestions are dynamically adjusted to your code style and context.

2. Natural language chat

  • Open the Copilot Chat panel in the VS Code sidebar (shortcut) Ctrl+Alt+I).
  • Ask a question in the input box, e.g., "How do I write a sorting algorithm in Python?"
  • Copilot returns code samples and text descriptions:
    def bubble_sort(arr):
    n = len(arr)
    for i in range(n):
    for j in range(0, n-i-1):
    if arr[j] > arr[j+1]:
    arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr
    

    The description will include how the algorithm works and scenarios of use.

3. Code editing recommendations

  • Select the code snippet and press the shortcut Ctrl+I Open the inline chat.
  • Enter a request such as "Optimize the performance of this code" Copilot suggests a more efficient way to write the code and displays the code differences of the changes. Example:
    // 原代码
    for (let i = 0; i < array.length; i++) {
    // 逻辑
    }
    // 优化建议
    array.forEach(item => {
    // 逻辑
    });
    
  • Click "Accept" to apply the changes or "Close" to ignore the suggestions.

4. Agent model

  • Select "Agent" mode in the chat panel.
  • Enter complex tasks, such as "Add JSON output support to my Express project and configure .env files".
  • Copilot analyzes the code base, generates file structures, and automatically edits the code. For example, adding .env Documentation:
    PORT=3000
    API_KEY=your_key
    

    and update the master file:

    require('dotenv').config();
    const port = process.env.PORT || 3000;
    
  • After confirming the changes, click "Keep" to apply all the suggestions.

5. Cross-document editing

  • Enter a task in the chat panel, e.g. "Add error handling to the entire project".
  • Copilot scans the project files, it is recommended to add the following to the relevant files try-catch Block. Changes are displayed with bolded file names for ease of review.

6. Tips for use

  • Use the slash command (e.g. /explain maybe /fix) to quickly invoke specific functions. For example, enter /explain Followed by a code snippet, Copilot will explain the code logic in detail.
  • Utilizing the Tips Library (VS Code 2022 17.12 and above), click on the book icon in the chat panel to view the FAQ template.
  • If the answer is not precise enough, explain it in more detail by asking a follow-up question уточнить, e.g., "Explain in more detail."

caveat

  • Ensure that VS Code and Copilot extensions are kept up-to-date to get the latest security fixes.
  • The free plan has a usage limit beyond which you need to upgrade your subscription, for details see GitHub Copilot official websiteThe
  • User code will not be used as suggestions for other users, and privacy is protected by the GitHub Privacy Statement.

 

application scenario

  1. Learn a new language or framework quickly
    Copilot Chat allows developers to ask for syntax or best practices when learning a new language like Go or Rust. For example, ask "How do I implement an HTTP server in Go?" to get the full code and instructions.
  2. Code debugging and optimization
    When you encounter a complex bug, select the code in question and ask "Why is this code reporting an error?", Copilot will analyze it and provide a fix, which is suitable for quickly locating the problem.
  3. Project Initialization
    When you create a new project, type "Create TypeScript Express application" and Copilot will generate the file structure, dependency configuration and base code, saving build time.
  4. Teamwork
    Team developers can leverage Agent Mode to automate repetitive tasks, such as adding test cases in bulk or standardizing code styles, for more efficient collaboration.

 

QA

  1. Do I need to pay to use Copilot Chat?
    No. GitHub offers a free plan that includes 2000 code completions and 50 chat requests per month. You can upgrade to a paid plan if you exceed the limit.
  2. How do I ensure the privacy of my code?
    GitHub promises that user code will not be used for suggestions for other users, following a strict privacy statement. See the GitHub Privacy Policy for details.
  3. What is the difference between Agent Mode and Normal Mode?
    Agent mode automates multi-step tasks such as modifying multiple files or running terminal commands. Normal mode is better suited for single code suggestions or interpretations.
  4. What programming languages are supported?
    Copilot Chat supports mainstream programming languages, including JavaScript, Python, Java, C++, Go, etc., covering a wide range of development scenarios.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish