We’re working on a new usage examples feature for Cody that shows you idiomatic usage examples, drawn from package sources and real-world usage across 1M+ repositories in the Sourcegraph.com index.
Principles:
- “A usage example is worth 1,000 lines of documentation”
- Seeing how a function is actually used in your code or high-quality open source code is super valuable
Try it:
- Install Cody for VS Code
- In your VS Code user settings, set
"cody.experimental.noodle": true
- On any function, type, or other symbol in a TypeScript file (
.ts
or.tsx
) that comes from an npm package, right-click > Cody > Usage Examples (or run Cody Command: Usage Examples in the VS Code command palette). - Look in the Cody chat window for usage examples. Expand the context to see select real-world usages.
Known issues:
- Currently only works in TypeScript files for symbols defined in public npm packages.
- Sometimes it will fail to find usages (and show an error). Please report these cases here! Known problematic cases:
react
- It currently only works if VS Code’s go-to-definition works on the symbol.
- The usage examples are generated by AI and may be incorrect. We are working on ways to improve this. Please report any incorrect or unhelpful usage examples you see.
- Only works in Cody Free/Pro (not Enterprise). Tell us if you want this in your Cody Enterprise!
Please post your feedback and suggestions on the usage examples experimental feature here. Thanks!