|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Setting Up GitHub Copilot\n", |
| 8 | + "Instructions on how to install and set up GitHub Copilot in your IDE." |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "code", |
| 13 | + "execution_count": null, |
| 14 | + "metadata": {}, |
| 15 | + "outputs": [], |
| 16 | + "source": [ |
| 17 | + "# Step 1: Open Visual Studio Code\n", |
| 18 | + "# Step 2: Click on the Extensions view icon on the Sidebar\n", |
| 19 | + "# Step 3: Search for 'GitHub Copilot'\n", |
| 20 | + "# Step 4: Click on the first result to open the extension's details\n", |
| 21 | + "# Step 5: Click on the install button\n", |
| 22 | + "# Step 6: Once installed, GitHub Copilot will automatically start providing suggestions when you write code" |
| 23 | + ] |
| 24 | + }, |
| 25 | + { |
| 26 | + "cell_type": "markdown", |
| 27 | + "metadata": {}, |
| 28 | + "source": [ |
| 29 | + "# Using Inline Ghost Prompts\n", |
| 30 | + "Exercises to practice using inline ghost prompts, which provide suggestions as you type." |
| 31 | + ] |
| 32 | + }, |
| 33 | + { |
| 34 | + "cell_type": "code", |
| 35 | + "execution_count": null, |
| 36 | + "metadata": {}, |
| 37 | + "outputs": [], |
| 38 | + "source": [ |
| 39 | + "# Step 7: Start a new Python file\n", |
| 40 | + "# Step 8: Begin typing a Python function or statement\n", |
| 41 | + "# For example, let's define a function to calculate factorial of a number\n", |
| 42 | + "\n", |
| 43 | + "def factorial(n):\n", |
| 44 | + " # As you type, GitHub Copilot will automatically suggest the rest of the code\n", |
| 45 | + " # Here, it might suggest the base case for the recursive function\n", |
| 46 | + " if n == 0:\n", |
| 47 | + " return 1\n", |
| 48 | + " # It might then suggest the recursive case\n", |
| 49 | + " else:\n", |
| 50 | + " return n * factorial(n-1)\n", |
| 51 | + "\n", |
| 52 | + "# Step 9: Accept the suggestion by pressing the Tab key on your keyboard\n", |
| 53 | + "# Step 10: Test the function with some inputs\n", |
| 54 | + "\n", |
| 55 | + "print(factorial(5)) # Expected output: 120\n", |
| 56 | + "print(factorial(3)) # Expected output: 6\n", |
| 57 | + "\n", |
| 58 | + "# Step 11: Continue practicing with other functions and observe the suggestions provided by GitHub Copilot\n", |
| 59 | + "# Remember, the suggestions are based on patterns and code snippets from public code repositories, so they might not always be perfect or optimal. Always review and test the code before using it." |
| 60 | + ] |
| 61 | + }, |
| 62 | + { |
| 63 | + "cell_type": "markdown", |
| 64 | + "metadata": {}, |
| 65 | + "source": [ |
| 66 | + "# Interacting with GitHub Copilot Chat\n", |
| 67 | + "Guidelines on how to use the GitHub Copilot chat for interactive programming help." |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "code", |
| 72 | + "execution_count": null, |
| 73 | + "metadata": {}, |
| 74 | + "outputs": [], |
| 75 | + "source": [ |
| 76 | + "# Step 12: Interacting with GitHub Copilot Chat\n", |
| 77 | + "# GitHub Copilot also provides a chat interface for interactive programming help\n", |
| 78 | + "# To use this feature, follow these steps:\n", |
| 79 | + "\n", |
| 80 | + "# Step 12.1: Open the command palette with `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac)\n", |
| 81 | + "# Step 12.2: Type `GitHub Copilot: Open Chat` and select the command\n", |
| 82 | + "# Step 12.3: In the chat interface, you can ask programming questions or request code snippets\n", |
| 83 | + "# For example, you can ask \"How to write a function to calculate Fibonacci series in Python?\"\n", |
| 84 | + "\n", |
| 85 | + "# Note: The chat interface is a new feature and might not be available in all regions or for all users. If you don't see the `GitHub Copilot: Open Chat` command, make sure you have the latest version of the GitHub Copilot extension and Visual Studio Code.\n", |
| 86 | + "\n", |
| 87 | + "# Step 13: Practice with GitHub Copilot Chat\n", |
| 88 | + "# Try asking some programming questions or requesting code snippets in the chat\n", |
| 89 | + "# Remember, just like with the inline suggestions, always review and test the code before using it." |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "markdown", |
| 94 | + "metadata": {}, |
| 95 | + "source": [ |
| 96 | + "# Working with Inline Chat\n", |
| 97 | + "Exercises to practice using the inline chat feature for collaborative coding." |
| 98 | + ] |
| 99 | + }, |
| 100 | + { |
| 101 | + "cell_type": "code", |
| 102 | + "execution_count": null, |
| 103 | + "metadata": {}, |
| 104 | + "outputs": [], |
| 105 | + "source": [ |
| 106 | + "# Step 14: Working with Inline Chat\n", |
| 107 | + "# GitHub Copilot also provides an inline chat feature for collaborative coding\n", |
| 108 | + "# To use this feature, follow these steps:\n", |
| 109 | + "\n", |
| 110 | + "# Step 14.1: Open the command palette with `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (Mac)\n", |
| 111 | + "# Step 14.2: Type `GitHub Copilot: Start Inline Chat` and select the command\n", |
| 112 | + "# Step 14.3: OYou cn also use 'Ctrl+I' (Windows/Linux) or `Cmd+I` (Mac) to start the inline chat\n", |
| 113 | + "# Step 14.4: In the inline chat interface, you can ask programming questions or request code snippets\n", |
| 114 | + "# For example, you can ask \"How to write a function to calculate the nth prime number in Python?\"\n", |
| 115 | + "\n", |
| 116 | + "# Note: The inline chat feature is a new feature and might not be available in all regions or for all users. If you don't see the `GitHub Copilot: Start Inline Chat` command, make sure you have the latest version of the GitHub Copilot extension and Visual Studio Code.\n", |
| 117 | + "\n", |
| 118 | + "# Step 15: Practice with GitHub Copilot Inline Chat\n", |
| 119 | + "# Try asking some programming questions or requesting code snippets in the inline chat\n", |
| 120 | + "# Remember, just like with the inline suggestions and the chat interface, always review and test the code before using it." |
| 121 | + ] |
| 122 | + } |
| 123 | + ], |
| 124 | + "metadata": { |
| 125 | + "language_info": { |
| 126 | + "name": "python" |
| 127 | + }, |
| 128 | + "orig_nbformat": 4 |
| 129 | + }, |
| 130 | + "nbformat": 4, |
| 131 | + "nbformat_minor": 2 |
| 132 | +} |
0 commit comments