You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cody/capabilities/commands.mdx
+16-44Lines changed: 16 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -72,36 +72,26 @@ Promoted Prompts are marked with an icon next to their name and appear at the to
72
72
73
73
Cody offers quick, ready-to-use **commands** for common actions to write, describe, fix, and smell code. These allow you to run predefined actions with smart context-fetching anywhere in the editor. Like autocomplete and chat, commands will search for context in your codebase to provide more contextually aware and informed answers.
74
74
75
-
Commands are available in VS Code, JetBrains, and the Sourcegraph web app. Commands can handle tasks like:
75
+
Commands are available in VS Code, JetBrains, Visual Studio, and the Sourcegraph web app. Commands can handle tasks like:
76
76
77
-
- Editing and fixing code `edit`
78
-
- Explaining code `explain`
79
-
- Generating unit tests `test`
80
-
- Writing documentation `doc`
81
-
- Improving code quality `smell`
82
-
83
-
Support for commands may vary by IDE extension. Read the [feature parity reference to learn what commands are available in your IDE](/cody/clients/feature-reference#commands).
84
-
85
-
<Callouttype="note">Cody’s responses to commands are often better than responses to chats since they’ve been pre-packaged and prompt-engineered.</Callout>
77
+
- Edit Code
78
+
- Document Code
79
+
- Explain Code
80
+
- Generate Unit Tests
81
+
- Find Code Smells
86
82
87
83
## Running commands
88
84
89
-
The process of running a command varies from one IDE to another. For example, in VS Code, there are several ways to run a command:
90
-
91
-
1. Select code in the editor and use the Cody commands sidebar to run a command:
Commands are available in the Cody chat panel under the Prompts drop-down in the editor extensions and on the web. You can run the commands via:
96
86
97
-
2. Run **Cody: Commands** in the VS Code command palette.
98
-
3. Right-click in the editor and select a command in the **Cody** submenu.
87
+
1. Select code in the editor and use the Cody commands from the Prompts drop-down to run a command:
88
+
2. Right-click in the editor and select a command in the **Cody** submenu.
99
89
100
90
## Custom commands
101
91
102
92
<Callouttype="info">Custom Commands are currently in Beta and only supported in VS Code.</Callout>
103
93
104
-
**Custom Commands** allow you to create and define reusable [prompts](#prompts)for Cody tailored to your development workflows. They are defined in `JSON` format and will enable you to call CLI tools, write custom prompts, and select context to be sent to Cody. This provides a flexible way to configure Cody to handle use cases like:
94
+
**Custom Commands** allow you to create your own commands for Cody that are tailored to your development workflows. They are defined in `JSON` format and will enable you to call CLI tools, write custom prompts, and select context to be sent to Cody. This provides a flexible way to configure Cody to handle use cases like:
105
95
106
96
- Integrate with your build system to suggest fixes for errors/warnings in the latest build
107
97
- Analyze software dependencies output to explain compatibility or suggest upgrades
@@ -112,35 +102,26 @@ The process of running a command varies from one IDE to another. For example, in
112
102
113
103
You can create a custom command by editing the configuration JSON file or using the command builder within the VS Code editor. To access the command builder within VS Code:
114
104
115
-
-Open the Cody commands menu (**Cody: Commands** in the command palette)
116
-
- Select **Custom commands > New Custom Command**
117
-
- Enter the name for your new custom command, such as `my-custom-command`.
118
-
-Next, write a description for the command. For example, `Compare files in open tabs` or `Explain current directory`
105
+
-Go to Cody settings, then select **Custom Commands Settings**
106
+
- Select **New Custom Command**
107
+
- Enter the name for your new custom command, such as `my-custom-command`
108
+
-Choose the method about how the command should be executed
119
109
- Provide the relevant instructions for Cody to follow. This is the `prompt` that Cody will use to pass relevant context to the LLM
120
110
- Then, select one or more options for the context Cody should use to generate responses
121
111
- Finally, choose whether to save the command locally or share it with your workspace
122
112
- Press **Enter** to complete the process, and your custom command is successfully created
123
113
- You can hit `esc` key at any time to discard a new custom command
124
114
125
-
### Running Custom Commands
126
-
127
-
You can invoke custom commands in 2 ways.
128
-
129
-
- Run **Cody Command: Custom Commands** in the VS Code command palette.
130
-
- Right-click in the editor and select **Cody > Custom Commands**.
131
-
132
-
Then select the command you want to run. If your custom command expects a code selection, be sure to select code in the editor before running the custom command.
133
-
134
115
### Configuring file paths
135
116
136
117
Custom Commands can be defined in the following two file paths:
137
118
138
119
-**User Settings (`~/.vscode/cody.json`)**: Stored locally. Use this for personal commands to use across all your projects
139
120
-**Workspace Settings (`.vscode/cody.json`)**: Stored in your project’s repository. Use this to share commands with others working on the same codebase and for project-specific commands
140
121
141
-
If you select **User Settings**, the new custom command will only be available to you. If you select **Workspace Settings** (as an enterprise user), the custom command will also be available to your teammates.
122
+
If you select User Settings, the new custom command will only be available to you. If you choose Workspace Settings (as an enterprise user), your teammates will also be able to use the custom command.
142
123
143
-
See the [examples](#examples) and [configuration properties](#configuration-properties) below for more details on configuring custom commands.
124
+
For more details on configuring custom commands, see the [examples](#examples) and [configuration properties](#configuration-properties) below.
144
125
145
126
<Accordiontitle="Custom Commands Examples">
146
127
@@ -338,13 +319,4 @@ See the [examples](#examples) and [configuration properties](#configuration-prop
338
319
- Type: `boolean`
339
320
- Default: `false`
340
321
341
-
342
-
{/* <!-- ### Defining commands in the `cody.json` file
343
-
344
-
You can define custom commands for Cody in the `cody.json` file. To make commands only available for a specific project, create the `cody.json` file in that project's `.vscode` directory. When you work on that project, these workspace-specific custom commands will be available.
345
-
346
-
To make custom commands globally available across multiple projects, create a new `cody.json` file in your home directory's `.vscode` folder. These global custom commands will be available in Cody in any workspace. --> */}
347
-
348
322
</Accordion>
349
-
350
-
<Callouttype="note">Commands and Custom Commands are soon going to be replaced by [prompts](#prompts) and [Prompt Library](#prompt-library) in the coming future.</Callout>
Copy file name to clipboardExpand all lines: docs/cody/capabilities/debug-code.mdx
+13-31Lines changed: 13 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -8,59 +8,41 @@ Cody is optimized to identify and fix errors in your code. Its debugging capabil
8
8
9
9
When you encounter a code error, you can use the chat interface and ask Cody about it. You can paste the faulty code snippets directly in the chat window, and Cody will provide a fix.
10
10
11
-
The suggestions can be a corrected code snippet that you can copy and paste into your code. Or you can ask a follow-up question for additional context to help you debug the code further. Moreover, you can also paste an error message in chat and ask Cody to provide you with a list of possible solutions.
11
+
The suggestions can be a corrected code snippet you can copy and paste into your code. Or you can ask a follow-up question for additional context to help debug the code. Moreover, you can paste an error message in the chat and ask Cody to provide a list of possible solutions.
12
12
13
13
Let's look at a simple example to understand how Cody can help you debug your code. The following code snippet should print the sum of two numbers.
14
14
15
15
```js
16
16
functionsum(a, b) {
17
-
var result = a + b;
18
-
console.log('The sum is: '+ $result);
17
+
var result = a + b;
18
+
console.log('The sum is: '+ $result);
19
19
}
20
20
21
21
sum(3 , 4);
22
22
```
23
23
24
24
When you try to `console.log` the `result`, it does not print the correct summed value. Cody can help you both identify the error and provide a solution to fix it. Let's debug the code snippet. Paste the code snippet inside the Cody chat window and ask Cody to fix it.
In addition, Cody helps you reduce the chances of getting syntax and typo errors. The Cody IDE extensions provide context-aware suggestions based on your codebase, helping you avoid common mistakes and reduce your debugging time.
30
+
In addition, Cody helps you reduce the chances of getting syntax and typo errors. The Cody IDE extensions provide context-aware suggestions based on your codebase, helping you avoid common mistakes and reduce debugging time.
31
31
32
32
## Detecting code smell
33
33
34
34
Cody can detect early code smells to ensure coding best practices and quality and provide suggestions to improve your code. By detecting such potential errors early on, you can avoid scalability and code maintainability issues that might arise in the future.
35
35
36
-
VS Code users can detect code smells by the `/smell` command, and JetBrains users can achieve the same by clicking the **Smell Code** button from the **Commands** tab.
37
-
38
-
Let's identify code smells on the same function from the previous example.
As you can see, Cody not only detects code smells but also provides suggestions to improve your code.
36
+
You can detect code smells by the **Find Code Smells** command from the Prompts drop-down menu in the chat panel.
46
37
47
38
## Code Actions
48
39
49
-
Cody VS Code extension users also get to use the **Code Actions** feature whenever there's an error in code syntax. When you make a mistake while writing code, Cody's Code Actions come into play, and a red warning triggers. Along this appears a lightbulb icon.
50
-
51
-
### How Code Actions work
40
+
<Callouttype="info">Code Actions are available onlyin Cody VS Code extension.</Callout>
52
41
53
-
Let's assume there's an error in the code, and the red warning triggers. Now follow these steps:
42
+
When you make a mistake while writing code, Cody's **Code Actions** come into play and a red warning triggers. Along with this, you get a lightbulb icon. If you click on this lightbulb icon, there is an **Ask Cody to fix** option.
54
43
55
-
- Click this lightbulb icon in the project file
44
+
- Click the lightbulb icon in the project file
56
45
- Select **Ask Cody to fix** option
57
-
-**Cody is working** notice will appear and provide a quick fix with options for **Edits Applied**, **Retry**, **Undo**, and **Done**
58
-
- If you are satisfied with the fix, click **Edits Applied**
59
-
- To verify the applied changes, you can see a diff view of the fix in a new tab
60
-
- If you are not satisfied with the fix, you can **Retry** or **Undo** the changes
61
-
62
-
Here's a demo that shows how Code Actions work:
46
+
-**Cody is working** notice will appear and provide a quick fix that you can **Accept**, **Reject**, or **Open Diff** view to see the changes
<pclassName="subtitle">Use additional context sources from outside of your code base by leveraging OpenCtx Providers.</p>
3
+
<pclassName="subtitle">Use additional context sources from outside of your codebase by leveraging OpenCtx providers.</p>
4
4
5
-
## Enable
5
+
<Callouttype="info">OpenCtx context providers are in the Experimental stage for all Cody users. Enterprise users can also use this, but with limited support. If you have feedback or questions, please visit our [support forum](https://community.sourcegraph.com/c/openctx/10).</Callout>
6
6
7
-
This feature is available in the Cody VS Code extension. In the Cody Settings, check the box for **OpenCtx: enable**. This will enable OpenCtx. **There is no need to install the OpenCtx extension; Cody comes with OpenCtx built-in.**
7
+
[OpenCtx](https://openctx.org/)is an open standard for bringing contextual info about code into your dev tools. Cody Free and Pro users can use OpenCtx providers to fetch and use context from the following sources:
OpenCtx Providers are added via your `settings.json` file in VS Code. The configuration looks something like this:
16
+
## Enable OpenCtx context providers
17
+
18
+
<Callouttype="note">OpenCtx context providers are only supported with Cody VS Code extension.</Callout>
19
+
20
+
To try OpenCtx context providers with Cody, you must add to your VS Code extension settings. Go to Cody Settings, and check the box for **OpenCtx: Enable**. This will enable OpenCtx. You don't need the OpenCtx VS Code extension to use context fetching with OpenCtx. You should uninstall the extension before using this feature in Cody.
21
+
22
+
For example, to use the [DevDocs provider](https://openctx.org/docs/providers/devdocs), add the following to your `settings.json`:
Please refer to the [context providers documentation](https://openctx.org/) for instructions and examples of configuring other providers such as Confluence, Jira, GitHub, Slack, Notion, Linear Issues, Linear Docs, Google Docs, and more.
32
+
Please refer to the [context providers docs](https://openctx.org/) for instructions and examples of configuring other providers such as Confluence, Jira, GitHub, Slack, Notion, Linear Issues, Linear Docs, Google Docs, and more.
Copy file name to clipboardExpand all lines: docs/cody/capabilities/supported-models.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Supported LLMs
2
2
3
-
## Chat and Commands
3
+
## Chat and Prompts
4
4
5
-
Cody supports a variety of cutting-edge large language models for use in Chat and Commands, allowing you to select the best model for your use case.
5
+
Cody supports a variety of cutting-edge large language models for use in chat and prompts, allowing you to select the best model for your use case.
6
6
7
7
<Callouttype="note">Newer versions of Sourcegraph Enterprise, starting from v5.6, it will be even easier to add support for new models and providers, see [Model Configuration](/cody/clients/model-configuration) for more information.</Callout>
0 commit comments