Quick Start

This chapter follows two official Quickstart paths: accept your first inline suggestion in VS Code, then open Chat and ask one question. Full steps: Quickstart for GitHub Copilot.

Finish Installation first. The samples use JavaScript; Python, TypeScript, Go, and others work the same way. GitHub notes Copilot is especially strong with Python, JavaScript, TypeScript, Ruby, Go, C#, and C++.


Open a practice folder

Windows (PowerShell 7):

mkdir $HOME\copilot-quickstart
cd $HOME\copilot-quickstart
code .

macOS:

mkdir -p ~/copilot-quickstart
cd ~/copilot-quickstart
code .

Confirm Copilot is signed in (Status Bar).


First completion (ghost text)

  1. Create dates.js.
  2. Type the function header (do not write the body yet):
function calculateDaysBetweenDates(begin, end) {
  1. Pause. Copilot usually fills a gray ghost-text body; the exact text varies.
  2. Accept: Tab.
  3. Reject: Esc, or keep typing to overwrite.

If gray text never appears: check that Copilot is not paused; try Alt+\ on Windows or Option+\ on macOS to trigger (see Completions).

Read the suggestion yourself. Date math is easy to get wrong by a day or a timezone. Accepting is not the same as being correct.


Steer the next line with a comment

On a new line, describe the goal in a natural-language comment, then an empty header:

// Return true if the year is a leap year in the Gregorian calendar.
function isLeapYear(year) {

When ghost text appears, Tab to accept or Esc to dismiss. That is official comment-driven code generation: the more specific the comment (edges, return type, what not to do), the closer the suggestion.


First Chat

Official VS Code Quickstart: open the Chat view.

OSShortcut
Windows / LinuxCtrl+Alt+I
macOSControl+Command+I

You can also click the Chat / Copilot icon in the title bar. If your organization disabled Chat, the box stays unusable—that is policy, not a broken shortcut.

Try this (select calculateDaysBetweenDates or keep dates.js focused):

Explain this function in three bullets. Quote any timezone assumptions.
Do not rewrite the file unless I ask.

Check whether the reply cites symbols from your file. If it wanders, add context: select code, or use #file / @workspace (see Chat).


Let Chat change one small thing (still review)

Then send:

Add a JSDoc comment to calculateDaysBetweenDates.
Keep the implementation. If begin > end, document the return value.

Chat may offer a patch or an insertable block. Before Keep / Accept, check:

  • Whether it touched files you did not ask for
  • Whether nulls, string dates, and timezones are still vague

Reject if you dislike it; shorten the prompt, or go back to typing with inline complete.

The official Quickstart also demos generating a full task-manager web app in Agent mode (multiple files). For this first hour stay on Ask / ordinary Chat until you can read a diff, then widen scope in Coding Agent.


First-hour checklist

  1. Extension installed, signed in with GitHub
  2. New dates.js, ghost text on calculateDaysBetweenDates
  3. Use Tab once and Esc once
  4. Comment-drive isLeapYear
  5. Open Chat with Ctrl+Alt+I / Control+Command+I and explain the file
  6. (Optional) On github.com, open a file in a repo you can access, click the Copilot icon, ask Explain this file.—the website Quickstart path

Windows vs macOS (this chapter)

ActionWindowsmacOS
Open ChatCtrl+Alt+IControl+Command+I
Command PaletteCtrl+Shift+PCmd+Shift+P
Accept completionTabTab
Dismiss completionEscEsc

Rebind in Keyboard Shortcuts by command name (for example editor.action.inlineSuggest.commit). Your local bindings win.


Next

评论