At this point it should be clear that high quality context enables much better, more relevant suggestions. While Codeium's retrieval engine does an excellent job of figuring out the most relevant code snippets to use as context, often times developers themselves know where the best context lives.
Suppose for example that you are writing test cases for a set of functions contained in file X using test framework Y. As the developer, you know that the best context is in file X and the files related to the test framework. Context Pinning enables developers to explicitly tell Codeium which information to pull in as context, guaranteeing that Codeium references that information when providing suggestions.
To pin items, navigate to the Context tab of the Chat panel. Here, you can choose Directories, Files, Repositories, or Code Context Items (like functions, classes, etc.) to pin as context as shown below. Pinned context items are pulled in for every suggestion.
Context Pinning is great for situations where you know you will be needing to reference information from other files for the duration of your current task (e.g. writing unit tests).
Best Practices
- Try to pin the “lowest common denominator” or the smallest subset of files that would be needed to address this task.
- Examples of Ideal Context Pinning:
- Internal Frameworks/Libraries: Pinning directories with code examples for using frameworks/libraries.
- Module Definitions: Pinning class/struct definition files inside your repo but in another module.
- Specific Tasks: Pinning a file or folder defining a particular interface (e.g., .proto files, abstract class files, config templates).
- Current Focus Area: Pinning the "lowest common denominator" directory containing the majority of files needed for your current coding session.
- Testing: Pinning a particular file with the class you are writing unit tests for.