Skip to content

Commit 29faa2a

Browse files
authored
Add more improvements (#749)
More cody docs improvements
1 parent e7289d0 commit 29faa2a

File tree

7 files changed

+92
-135
lines changed

7 files changed

+92
-135
lines changed

docs/cody/capabilities/commands.mdx

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -72,36 +72,26 @@ Promoted Prompts are marked with an icon next to their name and appear at the to
7272

7373
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.
7474

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:
7676

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-
<Callout type="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
8682

8783
## Running commands
8884

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:
92-
93-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
94-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/code-comments-cody-0724.mp4" type="video/mp4" />
95-
</video>
85+
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:
9686

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.
9989

10090
## Custom commands
10191

10292
<Callout type="info">Custom Commands are currently in Beta and only supported in VS Code.</Callout>
10393

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:
10595

10696
- Integrate with your build system to suggest fixes for errors/warnings in the latest build
10797
- 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
112102

113103
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:
114104

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
119109
- Provide the relevant instructions for Cody to follow. This is the `prompt` that Cody will use to pass relevant context to the LLM
120110
- Then, select one or more options for the context Cody should use to generate responses
121111
- Finally, choose whether to save the command locally or share it with your workspace
122112
- Press **Enter** to complete the process, and your custom command is successfully created
123113
- You can hit `esc` key at any time to discard a new custom command
124114

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-
134115
### Configuring file paths
135116

136117
Custom Commands can be defined in the following two file paths:
137118

138119
- **User Settings (`~/.vscode/cody.json`)**: Stored locally. Use this for personal commands to use across all your projects
139120
- **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
140121

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.
142123

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.
144125

145126
<Accordion title="Custom Commands Examples">
146127

@@ -338,13 +319,4 @@ See the [examples](#examples) and [configuration properties](#configuration-prop
338319
- Type: `boolean`
339320
- Default: `false`
340321

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-
348322
</Accordion>
349-
350-
<Callout type="note">Commands and Custom Commands are soon going to be replaced by [prompts](#prompts) and [Prompt Library](#prompt-library) in the coming future.</Callout>

docs/cody/capabilities/debug-code.mdx

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,41 @@ Cody is optimized to identify and fix errors in your code. Its debugging capabil
88

99
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.
1010

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.
1212

1313
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.
1414

1515
```js
1616
function sum(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);
1919
}
2020

2121
sum(3 , 4);
2222
```
2323

2424
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.
2525

26-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
27-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/fix-code.mp4" type="video/mp4" />
28-
</video>
26+
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
27+
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/fix-code.mp4" type="video/mp4" />
28+
</video>
2929

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 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.
3131

3232
## Detecting code smell
3333

3434
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.
3535

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.
39-
40-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
41-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/code-smells.mp4" type="video/mp4" />
42-
</video>
43-
44-
45-
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.
4637

4738
## Code Actions
4839

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+
<Callout type="info">Code Actions are available onlyin Cody VS Code extension.</Callout>
5241

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.
5443

55-
- Click this lightbulb icon in the project file
44+
- Click the lightbulb icon in the project file
5645
- 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
6347

64-
<video width="1920" height="1080" loop playsInline controls style={{ width: '100%', height: 'auto' }}>
65-
<source src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/code-actions.mp4" type="video/mp4" />
66-
</video>
48+
![code-actions](https://storage.googleapis.com/sourcegraph-assets/Docs/cody-code-actions-vscode-1124.png)

docs/cody/capabilities/openctx.mdx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
# OpenCtx Context Providers
22

3-
<p className="subtitle">Use additional context sources from outside of your code base by leveraging OpenCtx Providers.</p>
3+
<p className="subtitle">Use additional context sources from outside of your codebase by leveraging OpenCtx providers.</p>
44

5-
## Enable
5+
<Callout type="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>
66

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:
88

9-
## Configuration
9+
- [Webpages](https://openctx.org/docs/providers/web) (via URL)
10+
- [Jira tickets](https://openctx.org/docs/providers/jira)
11+
- [Linear issues](https://openctx.org/docs/providers/linear-issues)
12+
- [Notion pages](https://openctx.org/docs/providers/notion)
13+
- [Google Docs](https://openctx.org/docs/providers/google-docs)
14+
- [Sourcegraph code search](https://openctx.org/docs/providers/sourcegraph-search)
1015

11-
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+
<Callout type="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`:
1223

1324
```json
1425
"openctx.providers": {
15-
// ...other providers...
16-
"https://openctx.org/npm/@openctx/provider-devdocs": true,
26+
"https://openctx.org/npm/@openctx/provider-devdocs": {
27+
"urls": ["https://devdocs.io/go/", "https://devdocs.io/angular~16/"]
28+
}
1729
},
1830
```
1931

20-
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.

docs/cody/capabilities/supported-models.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Supported LLMs
22

3-
## Chat and Commands
3+
## Chat and Prompts
44

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.
66

77
<Callout type="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>
88

0 commit comments

Comments
 (0)