Get to know GitHub Copilot in VS Code and be productive IMMEDIATELY

Visual Studio Code
15 Feb 202404:45

Summary

TLDRGitHub Copilotは開発者のスキルを向上させるAIアシスタントです。インストール後、通常通りコーディングを始めることで「ゴーストテキスト」が自動的に有効になります。アイコンを確認してアクティブ状態を確認し、必要に応じて特定のファイルや言語で無効にできます。タブキーで補完を受け入れ、コマンドキーを併用して必要な分だけ補完を適用。代替の提案を見たい場合は、コマンドとエンターキーを押してサイドパネルを開きます。インラインチャットでコードを直接操作し、問題解決や意思決定を迅速に行うことができます。サイドバーのチャットエリアで問題解決や詳細の検討に役立て、全てのチャット履歴にアクセス可能です。GitHub Copilotはエラーの説明や修正にも優れ、ターミナルや他の場所でもサポートを提供しています。これらを駆使して開発者の生活をより良いものにしましょう。

Takeaways

  • 🎉 GitHub Copilotは開発者のスキルを向上させるのに役立つとのことです。
  • 🛠 特別な学習は必要なく、通常通りコーディングするだけでAIが働き始めます。
  • 👻 「ゴーストテキスト」機能は、GitHub Copilotの拡張機能をインストールしてログインすると自動的に有効になります。
  • 🔍 ステータスバーのアイコンでCopilotのアクティビティを確認できます。特定のファイルや言語でCopilotをオフにするにはアイコンをクリックします。
  • ✅ コメントを書くことで、望む機能をCopilotに伝えることができます。
  • 🗂 タブキーでGhost Textの補完を受け入れることができます。一部のみ必要な場合は、CtrlまたはCommandキーを押しながら右矢印キーで選択できます。
  • 🔄 CtrlまたはCommandとEnterキーを同時に押すと、より多くの代替提案を見ることができます。
  • 💬 「インラインチャット」機能を使うと、コード内で直接AIと対話できます。
  • 📝 インラインチャットは、コードを反復的に改善するのに便利です。
  • 🗃️ GitHub Copilotにはサイドバーにアクセスできるより従来のチャットエリアもあります。
  • 🔧 コード内の問題がある場合、GitHub Copilotはライトバルブまたはクイック提案メニューでエラーを説明し、修正することもできます。
  • ✨ スパークルアイコンをクリックすることで、ターミナルや他の場所でGitHub Copilotの助けを得ることができます。

Q & A

  • GitHub Copilotの使用を開始するにはどうすればよいですか?

    -GitHub Copilotの使用を開始するには、まず拡張機能をインストールしてGitHubにログインします。その後、通常通りコードを書くだけで、AIが動作します。

  • Ghost Textとは何ですか?

    -Ghost Textは、コードを書く際に自動的に提案されるテキストのことです。これにより、コーディングがスムーズに進みます。

  • GitHub Copilotがアクティブかどうかはどこで確認できますか?

    -GitHub Copilotがアクティブかどうかは、ステータスバーのGitHub Copilotアイコンで確認できます。

  • Ghost Textの提案を受け入れるにはどうすればよいですか?

    -Ghost Textの提案を受け入れるには、Tabキーを押します。部分的に受け入れる場合は、ControlキーまたはCommandキーを押しながら右矢印キーを押します。

  • Ghost Textを拒否するにはどうすればよいですか?

    -Ghost Textを拒否するには、Escapeキーを押します。

  • Inline Chatとは何ですか?

    -Inline Chatは、コード内で直接AIと対話できる機能です。ControlキーまたはCommandキーとIキーを押すことでトリガーされます。

  • GitHub Copilotのチャットエリアはどのようにアクセスしますか?

    -GitHub Copilotのチャットエリアは、サイドバーのチャットアイコンをクリックすることでアクセスできます。

  • GitHub Copilotはどのようにエラーを修正しますか?

    -GitHub Copilotは、コード内の問題が発生した際にライトバルブやクイックサジェストメニューでエラーの説明や修正提案を行います。

  • GitHub Copilotの履歴はどこで確認できますか?

    -GitHub Copilotの履歴は、チャットのトップにある履歴アイコンをクリックすることで確認できます。

  • GitHub Copilotを特定のファイルや言語で無効にするにはどうすればよいですか?

    -GitHub Copilotを特定のファイルや言語で無効にするには、ステータスバーのCopilotアイコンをクリックして無効にします。

Outlines

00:00

😀 GitHub Copilotの使い方と利点

GitHub Copilotは開発者のスキルを向上させるAIアシスタントで、使い始める方法やその機能について解説しています。Copilotは特別な学習は不要で、通常通りコーディングするだけで自動的に機能します。Ghost Text機能はコメントを書くことで自動的にコードを提案し、Tabキーで確定できます。Ghost Textの選択肢が合わなければ、ControlまたはCommandキーとEnterでサイドパネルから代替の提案を見ることができます。また、Inline Chatを利用してコード内で直接AIと対話し、コードの改善を行ったり、サイドバーのチャットエリアで問題解決や実装の詳細をブラストストームすることができます。エラー修正や問題解決にも利用でき、コードの改善案を提供します。

Transcripts

play00:00

So you've got GitHub Copilot.

play00:01

Congrats - Copilot can help you level up your skills as

play00:05

a developer in ways that you probably thought were not

play00:08

possible.

play00:09

Seriously.

play00:10

But now that you've got it, where do you start?

play00:12

How does it work?

play00:13

What do you need to learn?

play00:14

We're gonna answer all of that in this video, and

play00:17

I think you'll find that once you know how and

play00:20

where to use Copilot, it is pretty simple to dramatically

play00:23

increase your speed and productivity almost immediately.

play00:26

The secret of GitHub Copilot is that there isn't anything

play00:30

special that you need to do to learn how to

play00:32

interact with it.

play00:33

All you have to do to use GitHub Copilot is

play00:36

code.

play00:37

That's it.

play00:38

Just code like you normally would and watch the AI

play00:41

go to work.

play00:42

This is called "Ghost Text", and it's automatically turned on

play00:45

when you install the extension and log in to GitHub

play00:49

Copilot.

play00:50

You can verify that Copilot is active by checking for

play00:53

the GitHub Copilot icon down here in your status bar,

play00:57

and if you want to turn Copilot off for a

play01:00

specific file or language, click on this icon and you

play01:03

can disable it.

play01:04

You can also trigger Ghost Text by writing a comment

play01:07

expressing what you want.

play01:09

To accept a Ghost text completion, press Tab.

play01:13

If you only want part of the ghost text, you

play01:15

can just hold down the Control or Command keys and

play01:18

press the right arrow to accept as much or little

play01:21

of it as you want, and you can hit escape

play01:24

at any time to dismiss the ghost text.

play01:26

You can do a lot with just Ghost Text, and

play01:28

you'll find that Copilot is remarkably good at anticipating your

play01:32

next move and doing a lot of the work for

play01:35

you.

play01:35

For example, if I create a variable called nums, Copilot

play01:39

gives me what I probably want based on the name

play01:41

of the variable and the function in the file already

play01:44

an array of numbers.

play01:46

And if I press enter below the function, it assumes

play01:48

that I want to call the function and pass in

play01:51

the nums variable, which is exactly what I want.

play01:53

Now Ghost Text may give you what you want, or

play01:57

it may be close and almost, but a miss.

play01:59

In that case, you can see some alternative suggestions by

play02:03

pressing the Control or Command and Enter keys.

play02:06

This opens up a side panel where you can see

play02:09

more suggestions from the AI that you might like better.

play02:12

The other way that you can use GitHub Copilot right

play02:16

in your code is to chat with it directly, right

play02:19

here, using something that's called "Inline Chat."

play02:22

This can be triggered with the Control or Command and

play02:26

I keys.

play02:26

None of this code actually exists in your file until

play02:29

you accept it, so if you hit escape it will

play02:32

all just go away.

play02:33

No harm, no foul.

play02:34

Inline Chat is great for iterating on your code right

play02:38

in line.

play02:39

So for instance here,

play02:40

perhaps we want to return a static file at this

play02:42

route instead of what Copilot gave us, so we can

play02:45

highlight the block and iterate on that with Inline Chat.

play02:48

And Inline Chat always gives you a diff view showing

play02:51

you what's been added and changed so that you can

play02:53

be sure that this is what you want before you

play02:56

accept it.

play02:56

GitHub Copilot also features a more traditional dedicated chat area

play03:00

in the sidebar that you can access by clicking on

play03:03

the chat icon.

play03:05

If you've ever used another AI chat before, this will

play03:08

feel very familiar.

play03:09

While Ghost Text and Inline Chat are good for helping

play03:12

you code faster, chat is good for helping you solve

play03:15

problems and make decisions quicker.

play03:18

It is terrific for brainstorming and figuring out implementation details.

play03:22

You can always customize where the chat appears in your

play03:25

editor.

play03:25

So, for instance, if you'd like to see your code

play03:28

and your project files in the chat all at the

play03:30

same time, you can click on the secondary sidebar icon

play03:33

and just drag the chat into that sidebar.

play03:36

All of your chats are saved to a history that

play03:38

you can access at any time with the history icon

play03:41

at the top of the chat.

play03:43

There are a few other places that you'll find GitHub

play03:45

Copilot, and it can be quite useful.

play03:48

One of them is when you have a problem in

play03:50

your code,

play03:50

you'll find GitHub Copilot here in the light bulb or

play03:54

quick suggestion menu where it can explain and often even

play03:58

fix your errors right inline.

play04:00

Copilot is extremely good at fixing silly mistakes and explaining

play04:04

compiler errors that otherwise make no sense.

play04:08

You'll also find GitHub Copilot anywhere that you see this

play04:11

sparkle icon.

play04:12

This includes places like the Terminal and anywhere that GitHub

play04:16

Copilot might be able to help you out.

play04:18

All you have to do is keep your eye out

play04:20

for the sparkle and when you see it, give it

play04:23

a click and see what Copilot can do for you

play04:25

right then and there.

play04:27

And believe it or not, that's it.

play04:29

You now know the essentials of how to interact with

play04:32

GitHub Copilot.

play04:33

Go forth and see how much better life can be

play04:36

as a developer and make sure you check out our

play04:39

other videos on GitHub Copilot for all your AI coding

play04:42

needs.

play04:43

Happy coding.

Rate This

5.0 / 5 (0 votes)

関連タグ
GitHubCopilot開発効率AIサポートコード補完プログラミングGhost TextInline Chatエラー修正コーディング