| 1 | // _________ _____ _____ |
| 2 | // __ ____/______ _______ __ /____(_)_______ ____ _______ |
| 3 | // _ / _ __ \__ __ \_ __/__ / __ __ \_ / / /_ _ \ |
| 4 | // / /___ / /_/ /_ / / // /_ _ / _ / / // /_/ / / __/ |
| 5 | // \____/ \____/ /_/ /_/ \__/ /_/ /_/ /_/ \__,_/ \___/ |
| 6 | // |
| 7 | // Chat, Edit, and Autocomplete tutorial |
| 8 | // |
| 9 | |
| 10 | // ———————————————————————————————————————————————— Setup ————————————————————————————————————————————————- |
| 11 | |
| 12 | // First, open the Continue sidebar by pressing [Cmd + L] or clicking the Continue icon. |
| 13 | |
| 14 | // See an example at https://docs.continue.dev/getting-started/install |
| 15 | |
| 16 | // Follow the instructions in the sidebar to set up a Chat/Edit modela and an Autocomplete model. |
| 17 | |
| 18 | // ————————————————————————————————————————————————— Chat ————————————————————————————————————————————————— |
| 19 | |
| 20 | // Highlight the code below |
| 21 | // Press [Cmd + L] to add to Chat |
| 22 | // Try asking Continue "what sorting algorithm is this?" |
| 23 | public static int[] sortingAlgorithm(int[] x) { |
| 24 | for (int i = 0; i < x.length; i++) { |
| 25 | for (int j = 0; j < x.length - 1; j++) { |
| 26 | if (x[j] > x[j + 1]) { |
| 27 | int temp = x[j]; |
| 28 | x[j] = x[j + 1]; |
| 29 | x[j + 1] = temp; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | return x; |
| 34 | } |
| 35 | |
| 36 | // [Cmd + L] always starts a new chat. Now, try the same thing using [Cmd + Shift + L]. |
| 37 | // This will add the code into the current chat |
| 38 | |
| 39 | // ————————————————————————————————————————————————— Edit ————————————————————————————————————————————————— |
| 40 | |
| 41 | // Highlight the code below |
| 42 | // Press [Cmd + I] to Edit |
| 43 | // Try asking Continue to "make this more readable" |
| 44 | public static int[] sortingAlgorithm2(int[] x) { |
| 45 | for (int i = 0; i < x.length; i++) { |
| 46 | for (int j = 0; j < x.length - 1; j++) { |
| 47 | if (x[j] > x[j + 1]) { |
| 48 | int temp = x[j]; |
| 49 | x[j] = x[j + 1]; |
| 50 | x[j + 1] = temp; |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | return x; |
| 55 | } |
| 56 | |
| 57 | // ————————————————————————————————————————————— Autocomplete —————————————————————————————————————————————— |
| 58 | |
| 59 | // Place cursor after `sortingAlgorithm:` below and press [Enter] |
| 60 | // Press [Tab] to accept the Autocomplete suggestion |
| 61 | |
| 62 | // Basic assertion for sortingAlgorithm: |
| 63 | |
| 64 | |
| 65 | |
| 66 | // —————————————————————————————————————————————- Learn More -—————————————————————————————————————————————— |
| 67 | |
| 68 | // Visit the Continue Docs at https://docs.continue.dev/getting-started/overview |