AI helps you write code -Copilot use experience

Introduction to the

Github Copilot

English class

  • Pilot pronunciation[ˈ pa goes t ɪ l]The pilot
  • Copilot pronunciation[ˈ ko ˌ pa goes t ɪ l]Co-pilot

Co -, a variant of com-, means auxiliary, common, or complementary. Other similar words:

  • Operation operation
  • Cooperation

Github Copilot

copilot.github.com/

Your AI pair Programmer. You can get entire lines of advice or complete functions in the editor.

Trained on billions of lines of open source code, it puts the knowledge you need at your fingertips, saves you time and helps you stay focused.

Powered by OpenAI

OpenAI is a non-profit artificial intelligence (AI) research organization whose purpose is to promote and develop friendly AI for the benefit of humanity as a whole. Founded in late 2015, SAN Francisco-based OpenAI aims to make its patents and research results available to the public through “free collaboration” with other institutions and researchers. Founders Elon Musk and Sam Altman were motivated by concerns about the potential risks of strong ARTIFICIAL intelligence.

By 2018, OpenAI was headquartered in San Francisco’s Mission District, in the same office building as Elon Musk’s Neuralink. [8]

On July 22, 2019, Microsoft invested $1 billion in OpenAI, and the two companies will work together to develop artificial intelligence technology for Azure cloud platform services. The GPT-3 language model was announced on 11 June 2020, and Microsoft acquired the exclusive license on 22 September 2020.

Features:

  • Editor, IDE extensions
  • Understand almost all programming languages and frameworks
  • You are the master driver, copilot provides suggestions and is close to your code style

features

Complete the code according to the function name

I typed

const bubbleSort
Copy the code

Complete the code according to the comments

I typed

// check the mailboxCopy the code

The generated code

// The mailbox is regular
var email_reg = /^([a-zA-Z0-9]+[_|\_|\.]?) *[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?) * [a zA - Z0-9] + \. [a zA - Z] {2, 3} $/;

// Check the mailbox
function check_email(email) {
    if(! email_reg.test(email)) {return false;
    }
    return true;
}
Copy the code

I typed

/**
 * once a week
 */
Copy the code

After automatic completion

/** * once a week */
export const onceAWeek = (key: string, callback: () => void) = > {
  const now = new Date().getTime();
  const last = localStorage.getItem(key);
  if (last) {
    const lastTime = Number(last);
    if (now - lastTime < 7 * 24 * 60 * 60 * 1000) {
      return; }}localStorage.setItem(key, now.toString());
  callback();
}
Copy the code

Complete the code line by line according to context

I need a request interface in a Service class that references my other code and completes what I want to write line by line

Just guess what the next line of code is

In an utils file, after I type const, it guesses what I’m going to code next

How it works

Frequently asked questions

Copilot.github.com/#faq-will-m…

Will my private code be shared with other users?

No. We use telemetry data, including information about which suggestions users accept or reject, to improve the model. Your private code is not used as suggested code for other users of GitHub Copilot.

Don’t. We use telemetry data, including information about which suggestions users accept or reject, to refine the model. Your private code will not be used as suggested code for other GitHub Copilot users.

Privacy and data security related copilot.github.com/#faq-privac…

summary

Overall, GitHub Copilot is a great code generator for general-purpose utility code, Leetcode algorithms, and high-frequency code for unit testing scenarios, with the greatest value in saving you time looking through documents. It may not be accurate for business code, and there may be data security risks. Give it a try. It’s currently in beta and hasn’t been released yet.