Giter Club home page Giter Club logo

skills-copilot-codespaces-vscode's Introduction

Code with GitHub Copilot

GitHub Copilot can help you code by offering autocomplete-style suggestions right in VS Code and Codespaces.

Step 4: Using comments to generate code with Copilot

Nicely done utilizing the Copilot tab! 🥳

You now have leveraged the Copilot quick tab auto-suggest as well as the Copilot hub to accept AI generated suggestions.

Now lets see how you can leverage comments to generate Copilot suggestions!

⌨️ Activity: Pull the latest code to the Codespace repo.

Note Pull MUST be done prior to the next activity.

  1. Use the VS Code terminal to pull the latest code:

    git pull
    

⌨️ Activity: Generate Copilot suggested code from comments.

  1. From inside the codespace in the VS Code explorer window, create a new file. (If you closed the Codespace from above, please open it back up or create a new Codespace.)

  2. Name the file comments.js.

  3. Type the following comment into the file:

    // Create web server
    
  4. Press enter to go to a new line.

  5. Copilot will suggest a code block.

  6. Hover over the red squiggly and select the ...

    Note If you don't see the copilot code block suggestion or the red squiggly and the three dots ..., you can type control + enter to bring up the GitHub Copilot completions panel.

  7. Click Open Completions Panel. Copilot will synthesise around 10 different code suggestions. You should see something like this: Screen Shot 2023-04-25 at 3 59 42 PM

  8. Find a solution you like and click Accept Solution.

  9. Your comments.js file will be updated with your solution.

⌨️ Activity: Push code to your repository from the codespace

  1. Use the VS Code terminal to add the comments.js file to the repository:

    git add comments.js
    
  2. Next from the VS Code terminal stage and commit the changes to the repository:

    git commit -m "Copilot third commit"
    
  3. Finally from the VS Code terminal push to code to the repository:

    git push
    

Wait about 60 seconds then refresh your repository landing page for the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License

skills-copilot-codespaces-vscode's People

Contributors

kindlehub avatar github-actions[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.