diff --git a/docs/docs/actions/advanced-configuration.md b/docs/docs/actions/advanced-configuration.md index 3f0879b64..294791151 100644 --- a/docs/docs/actions/advanced-configuration.md +++ b/docs/docs/actions/advanced-configuration.md @@ -1,7 +1,55 @@ --- title: Advanced configuration -description: \-advanced configuration +description: Actions \-advanced configuration keywords: [configuration, advanced] --- # Advanced configuration + +## Built-in slash commands + +Continue has a large library of built-in slash commands, but when you first install we only display the most commonly used ones, like “/edit”, “/comment”, and “/share”. To add more actions, you can open [config.json](https://docs.continue.dev/reference/config-json.md) and add them to the `slashCommands` array. + +## Custom slash commands + +There are two ways to add custom slash commands: + +1. With `.prompt` files - this is recommended in most cases. See the full reference [here](../reference/prompt-files.md). +2. With `config.ts` - this gives you full programmatic access to the LLM, IDE, and other important entities by writing a JavaScript/TypeScript function + +### Custom Slash Commands with `config.ts` + +:::tip[config.ts] +Before adding a custom slash command, we recommend reading the [introduction to `config.ts`](../reference/config-ts.md). +::: + +If you want to go a step further than writing custom commands with natural language, you can write a custom function that returns the response. This requires using `config.ts` instead of `config.json`. + +To do this, push a new `SlashCommand` object to the `slashCommands` list. This object contains "name", the name that you will type to invoke the slash command, "description", the description seen in the dropdown menu, and "run". The `run` function is any async generator that should yield strings as you want them to be streamed to the UI. As an argument to the function, you have access to a `ContinueSDK` object with utilities such as access to certain information/actions within the IDE, the current language model, and a few other utilities. For example, here is a slash command that generates a commit message: + +```typescript title="~/.continue/config.ts" +export function modifyConfig(config: Config): Config { + config.slashCommands?.push({ + name: "commit", + description: "Write a commit message", + run: async function* (sdk) { + const diff = await sdk.ide.getDiff(); + for await (const message of sdk.llm.streamComplete( + `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + { + maxTokens: 20, + }, + )) { + yield message; + } + }, + }); + return config; +} +``` + +For full `config.ts` reference, see [here](../reference/config-ts.md). + +## Other custom actions + +Currently the other action triggers are not open for configuration, but we plan to allow this via .prompt files in the future. diff --git a/docs/docs/actions/context-selection.md b/docs/docs/actions/context-selection.md index c754d26cf..f8d33aae2 100644 --- a/docs/docs/actions/context-selection.md +++ b/docs/docs/actions/context-selection.md @@ -1,7 +1,37 @@ --- title: Context selection -description: \-context selection -keywords: [context] +description: Actions \-context selection +keywords: [context, slash, debug, quick fix, right click] --- # Context selection + +## Slash commands + +Slash commands can be combined with additional instructions, including [context providers](../chat/context-selection.md) or [highlighted code](../chat/context-selection.md). + +For example, with the “/edit” slash command you should describe the edit that you want the LLM to perform. + +Some slash commands will not acknowledge your input; for example, the “/share” slash command just creates a markdown copy of the current conversation, regardless of what else you may request it to do. + +## Quick actions + +Quick actions are always displayed above a class or function and will edit that class or function, but nothing outside of it. + +## Right click actions + +The highlighted code you’ve selected will be included in your prompt alongside a pre-written set of instructions depending on the selected action. This is the only section of code that the model will attempt to edit. + +## Debug action + +The debug action selects the most recently run terminal command and its output and then injects the following prompt into the chat window. There is no additional, non-visible information sent to the language model. + +``` +I got the following error, can you please help explain how to fix it? + +[ERROR_MESSAGE] +``` + +## Quick fixes + +Similarly to the debug action, quick actions transparently inject a prompt into the chat window. When you select “Ask Continue”, the 3 lines above and below the error are sent to the chat followed by the question “How do I fix the following problem in the above code?: [ERROR_MESSAGE]”. diff --git a/docs/docs/actions/how-it-works.md b/docs/docs/actions/how-it-works.md index 84f930ad6..b5421ddca 100644 --- a/docs/docs/actions/how-it-works.md +++ b/docs/docs/actions/how-it-works.md @@ -1,7 +1,13 @@ --- title: How it works -description: \-how it works -keywords: [how] +description: Actions \-how it works +keywords: [how, slash, commands, prompt, right click, quick fix, debug, action] --- # How it works + +While many actions are based on templated prompts and can be customized with .prompt files, there are a number that execute more complex code under the hood. + +Actions that generate inline diffs, like “/edit”, “/comment”, or right click actions, use the same prompt and response processing logic as [Edit](../edit/how-it-works.md). + +To learn how other slash commands work, see the full reference [here](../reference/slash-commands). diff --git a/docs/docs/actions/how-to-use-it.md b/docs/docs/actions/how-to-use-it.md index b73f91f06..8db599cff 100644 --- a/docs/docs/actions/how-to-use-it.md +++ b/docs/docs/actions/how-to-use-it.md @@ -1,7 +1,81 @@ --- title: How to use it -description: How to use it -keywords: [how] +description: Actions \- how to use it +keywords: [how, slash, commands, prompt, right click, quick fix, debug, action] --- -# How to use it \ No newline at end of file +# How to use it + +Actions are shortcuts for common use cases. For example, you might want to review code, write tests, or add a docstring. + +## Slash commands + +The most common way to invoke an action is with a slash command. These are shortcuts that can be activated by typing '/' and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor. + +![slash-commands](/img/slash-commands.png) + +A few of the most useful slash commands are available by default, like “/edit”, “/comment”, and “/share”, but Continue has a large built-in library of other options. To enable these, learn more [here](TODO). + +## Prompt files + +It is also possible to write your own slash command by defining a “.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more. + +The full .prompt file reference can be found [here](TODO). + +:::tip[Prompt library] +To assist you in getting started, [we've curated a small library of `.prompt` files](https://github.com/continuedev/prompt-file-examples). We encourage community contributions to this repository, so please consider opening up a pull request with your own prompts! +::: + +Below is a quick example of setting up a prompt file to write unit tests using Jest. + +1. Create a folder called `.prompts/` at the top level of your workspace. +2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt. +3. Write the following contents to `test.prompt` and save. + +``` +{{{ input }}} + +Write unit tests for the above selected code, following each of these instructions: +- Use `jest` +- Properly set up and tear down +- Include important edge cases +- The tests should be complete and sophisticated +- Give the tests just as chat output, don't edit any file +- Don't explain how to set up `jest` +``` + +Now to use this prompt, you can highlight code and use `cmd/ctrl+L` to select it in the Continue sidebar. + +Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file. + +## Other triggers for actions (VS Code) + +:::info +Currently all of these are only available in VS Code +::: + +To make common use cases even more accessible, we provide a handful of other ways to invoke actions. + +### Quick actions + +Quick Actions are displayed as buttons above top-level classes and functions in your source code, letting you invoke actions with one click. They can also be customized with .prompt files to perform custom actions. + +![quick-actions](/img/quick-actions.png) + +By default, quick actions are disabled, but can be enabled with the “Continue: Enable Quick Actions” in VS Code settings. + +### Right click actions + +Right click actions let you highlight a desired region of code, right click, and then select an action from the dropdown menu. + +![context-menu](/img/context-menu.png) + +### Debug action + +The debug action is a special built-in keyboard shortcut in the VS Code extension. Use `cmd/ctrl+shift+R` to instantly copy the contents of the current terminal into the chat sidebar and get debugging advice. + +### Quick fixes + +Whenever you see red/yellow underlines in your code indicating errors, you can place your cursor nearby and VS Code will display a lightbulb icon. Either clicking the lightbulb or using the keyboard shortcut `cmd/ctrl+.` will show a dropdown menu of quick fixes. One of these will be the “Ask Continue” action. Either click or use `cmd/ctrl+.` again and Continue will attempt to help solve the problem. + +![ask-continue](/img/ask-continue.png) diff --git a/docs/docs/actions/model-setup.md b/docs/docs/actions/model-setup.md index e564f7419..aaf64c881 100644 --- a/docs/docs/actions/model-setup.md +++ b/docs/docs/actions/model-setup.md @@ -1,7 +1,11 @@ --- title: Model setup -description: \-model setup +description: Actions \-model setup keywords: [model] --- # Model setup + +By default, actions uses the same model as Chat since we recommend a similar, 400B+ parameter model for the complex instructions that will be carried out. + + diff --git a/docs/docs/autocomplete/advanced-configuration.md b/docs/docs/autocomplete/advanced-configuration.md index 3f0879b64..4248e8f29 100644 --- a/docs/docs/autocomplete/advanced-configuration.md +++ b/docs/docs/autocomplete/advanced-configuration.md @@ -1,7 +1,23 @@ --- title: Advanced configuration -description: \-advanced configuration +description: Autocomplete \- advanced configuration keywords: [configuration, advanced] --- -# Advanced configuration +Experiment with these settings to find the perfect balance between suggestion quality and system performance for your specific needs and hardware capabilities: + +```config.json + "tabAutocompleteOptions": { + "useCopyBuffer": false, + "maxPromptTokens": 400, + "prefixPercentage": 0.5 + "multilineCompletions": "always" + } +``` + +- `useCopyBuffer`: Determines if the clipboard content should be considered in prompt construction. +- `maxPromptTokens`: Sets the maximum number of tokens for the prompt, balancing context and speed. +- `prefixPercentage`: Defines the proportion of the prompt dedicated to the code before the cursor. +- `multilineCompletions`: Controls whether suggestions can span multiple lines ("always", "never", or "auto"). + +For a comprehensive guide on all configuration options and their impacts, refer to our (detailed configuration documentation). diff --git a/docs/docs/autocomplete/context-selection.md b/docs/docs/autocomplete/context-selection.md index c754d26cf..ce904f97f 100644 --- a/docs/docs/autocomplete/context-selection.md +++ b/docs/docs/autocomplete/context-selection.md @@ -1,7 +1,17 @@ --- title: Context selection -description: \-context selection +description: Autocomplete \-context selection keywords: [context] --- -# Context selection +Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt: + +### File prefix/suffix + +We will always include the code from your file prior to and after the cursor position. + +### Type definitions from the LSP + +### Recent files + +We automatically consider recently opened or edited files and include snippets that are relevant to the current completion. diff --git a/docs/docs/autocomplete/how-it-works.md b/docs/docs/autocomplete/how-it-works.md index 84f930ad6..40fd6b75b 100644 --- a/docs/docs/autocomplete/how-it-works.md +++ b/docs/docs/autocomplete/how-it-works.md @@ -1,7 +1,17 @@ --- title: How it works -description: \-how it works -keywords: [how] +description: Autocomplete \-how it works +keywords: [how, autocomplete, context] --- # How it works + +Continue’s autocomplete is a [compound AI system]() that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts. + +## Timing + +## Context + +## Filtering + +Continue's autocomplete analyzes your code context, including the current file, cursor position, and recent edits. It crafts a smart prompt using this information and relevant snippets from other files. The system then uses a language model to generate code suggestions, which can include multi-line completions or edits to existing code. These suggestions are refined for relevance and correctness, with successful completions cached for future use. Finally, the system displays the suggestions as ghost text for new additions or diff popups for modifications, allowing you to easily understand and incorporate the proposed changes. diff --git a/docs/docs/autocomplete/how-to-use-it.md b/docs/docs/autocomplete/how-to-use-it.md index cdc985f94..ace7824e7 100644 --- a/docs/docs/autocomplete/how-to-use-it.md +++ b/docs/docs/autocomplete/how-to-use-it.md @@ -1,7 +1,23 @@ --- title: How to use it -description: How to use it +description: Autocomplete \- how to use it keywords: [how] --- # How to use it + +Tab autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings. + +## See when ghost text appears + +Autocomplete will suggest code based on your recent changes for every keystroke or cursor movement. You'll see suggestions appear as ghost text when adding new code or when modifying existing code. Suggestions may not always appear if no changes are predicted. + +## Accept the suggestions + +Accept a full suggestion by pressing Tab, or reject it with Esc. Use Ctrl/CMD + → to accept part of a suggestion word-by-word, allowing for more granular control. To reject a suggestion, simply continue typing or press Escape. + +:::tip + +Getting only ever single-line suggestions? To ensure multi-line completions, set "multilineCompletions": "always" in tabAutocompleteOptions. If you're still seeing only single-line completions, try temporarily moving text below your cursor out of your active file or switching to a larger model. + +::: diff --git a/docs/docs/autocomplete/model-setup.md b/docs/docs/autocomplete/model-setup.md index e564f7419..096d71458 100644 --- a/docs/docs/autocomplete/model-setup.md +++ b/docs/docs/autocomplete/model-setup.md @@ -1,7 +1,51 @@ --- title: Model setup -description: \-model setup -keywords: [model] +description: Autocomplete \-model setup +keywords: [model, autocomplete] --- # Model setup + +## Best autocomplete experience (Codestral) + +For the best autocomplete experience, we recommend using Codestral through the [Mistral API](https://console.mistral.ai/). This model offers high-quality completions with an excellent understanding of code context: + +```config.json +{ + "tabAutocompleteModel": { + "title": "Codestral", + "provider": "mistral", + "model": "codestral-latest", + "apiKey": "YOUR_API_KEY" + } +} +``` + +## Self Hosted / Local + +For those preferring local execution or self-hosting, StarCoder2-3b offers a good balance of performance and quality for most users: + +```config.json +{ + "tabAutocompleteModel": { + "title": "StarCoder2-3b", + "model": "starcoder2:3b", + "provider": "ollama", + } +} +``` + +### Alternatives + +- Need to be faster? Try deepseek-coder:1.3b-base for quicker completions on less powerful hardware. +- Have more compute? Use deepseek-coder:6.7b-base for potentially higher-quality suggestions. + +:::note + +For LM Studio users, navigate to the "My Models" section, find your desired model, and copy the path (e.g., second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf). Use this path in your configuration. + +::: + +## More + +There are many more models and providers you can use with Autocomplete. Check them out [here](../reference/Model%20Providers/). diff --git a/docs/static/img/ask-continue.png b/docs/static/img/ask-continue.png new file mode 100644 index 000000000..1e416ea44 Binary files /dev/null and b/docs/static/img/ask-continue.png differ diff --git a/docs/static/img/context-menu.png b/docs/static/img/context-menu.png new file mode 100644 index 000000000..8562b46d0 Binary files /dev/null and b/docs/static/img/context-menu.png differ diff --git a/docs/static/img/quick-actions.png b/docs/static/img/quick-actions.png new file mode 100644 index 000000000..f468279e0 Binary files /dev/null and b/docs/static/img/quick-actions.png differ