✨ polish code context provider

This commit is contained in:
Nate Sesti 2024-03-12 01:17:06 -07:00
parent b006874353
commit 7a01d29b1b
5 changed files with 24 additions and 38 deletions

View file

@ -88,36 +88,12 @@ function loadSerializedConfig(
config.allowAnonymousTelemetry = true;
}
migrate("codebaseContextProvider", () => {
if (
!config.contextProviders?.filter((cp) => cp.name === "codebase")?.length
) {
migrate("codeContextProvider", () => {
if (!config.contextProviders?.filter((cp) => cp.name === "code")?.length) {
config.contextProviders = [
...(config.contextProviders || []),
{
name: "codebase",
params: {},
},
];
}
if (!config.embeddingsProvider) {
config.embeddingsProvider = {
provider: "transformers.js",
};
}
fs.writeFileSync(configPath, JSON.stringify(config, undefined, 2), "utf8");
});
migrate("problemsContextProvider", () => {
if (
!config.contextProviders?.filter((cp) => cp.name === "problems")?.length
) {
config.contextProviders = [
...(config.contextProviders || []),
{
name: "problems",
name: "code",
params: {},
},
];
@ -126,14 +102,12 @@ function loadSerializedConfig(
fs.writeFileSync(configPath, JSON.stringify(config, undefined, 2), "utf8");
});
migrate("foldersContextProvider", () => {
if (
!config.contextProviders?.filter((cp) => cp.name === "folder")?.length
) {
migrate("docsContextProvider1", () => {
if (!config.contextProviders?.filter((cp) => cp.name === "docs")?.length) {
config.contextProviders = [
...(config.contextProviders || []),
{
name: "folder",
name: "docs",
params: {},
},
];

4
core/index.d.ts vendored
View file

@ -426,7 +426,9 @@ type ContextProviderName =
| "folder"
| "jira"
| "postgres"
| "database";
| "database"
| "code"
| "docs";
type TemplateType =
| "llama2"

View file

@ -155,7 +155,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex {
for (const snippet of snippetsWithPath) {
await db.run(
`INSERT INTO code_snippet_tags (snippetId, tag) VALUES (?, ?)`,
`INSERT INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)`,
[snippet.id, tagString],
);
}
@ -195,7 +195,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex {
const db = await SqliteDb.get();
try {
const rows = await db.all(
`SELECT *
`SELECT cs.id, cs.path, cs.title
FROM code_snippets cs
JOIN code_snippets_tags cst ON cs.id = cst.snippetId
WHERE cst.tag = ?;

View file

@ -16,6 +16,14 @@ As an example, say you are working on solving a new GitHub Issue. You type '@iss
To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list.
### Code
Type '@code' to reference specific functions or classes from throughout your project.
`````json
{ "name": "code" }
```
### Git Diff
Type '@diff' to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
@ -145,7 +153,7 @@ By default, the following query will be used to find issues:
```jql
assignee = currentUser() AND resolution = Unresolved order by updated DESC
````
`````
You can override this query by setting the `issueQuery` parameter.

View file

@ -1045,7 +1045,8 @@
"tree",
"highlights",
"outline",
"postgres"
"postgres",
"code"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1064,7 +1065,8 @@
"Include a repo map showing important code objects",
"Displays important snippets of code from the currently open files",
"Displays definition lines from the currently open files",
"References Postgres table schema and sample rows"
"References Postgres table schema and sample rows",
"Reference specific functions and classes from throughout your codebase"
],
"type": "string"
},