Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mongodb-js/vscode into gagik/filter…
Browse files Browse the repository at this point in the history
…-message-history
  • Loading branch information
gagik committed Dec 3, 2024
2 parents 9a38ba2 + 2d9d5f5 commit 545207a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@
"submenus": [
{
"id": "mdb.copilot",
"label": "MongoDB Copilot Participant"
"label": "MongoDB Copilot Extension"
}
],
"keybindings": [
Expand Down Expand Up @@ -1228,6 +1228,7 @@
"@types/mkdirp": "^2.0.0",
"@types/mocha": "^8.2.3",
"@types/node": "^14.18.63",
"@types/prettier": "^2.7.3",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.25",
"@types/sinon": "^9.0.11",
Expand Down
22 changes: 14 additions & 8 deletions scripts/generate-icon-font.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import webfont from 'webfont';
import fs from 'fs/promises';
import { GlyphData } from 'webfont/dist/src/types';
import prettier from 'prettier';

/** Icons to include in the generated icon font */
const INCLUDED_ICONS = ['connection-active', 'connection-inactive'];
Expand Down Expand Up @@ -40,14 +41,19 @@ async function main(): Promise<void> {
});

// Prints out the VSCode configuration package.json
console.info(
JSON.stringify(
{
icons: iconsConfig,
},
undefined,
2
)
const currentConfiguration = JSON.parse(
await fs.readFile('./package.json', 'utf8')
);

currentConfiguration.contributes.icons = iconsConfig;

const prettierConfig = await prettier.resolveConfig('./.prettierrc.json');
await fs.writeFile(
'./package.json',
prettier.format(JSON.stringify(currentConfiguration), {
...prettierConfig,
parser: 'json-stringify',
})
);
}

Expand Down
24 changes: 24 additions & 0 deletions src/participant/prompts/exportToPlayground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ export class ExportToPlaygroundPrompt extends PromptBase<PromptArgsBase> {
protected getAssistantPrompt(): string {
return `You are a MongoDB expert.
Your task is to convert user's code written in any programming language to the MongoDB mongosh shell script.
If the user's code contains a database and collection name, preserve them in the transpiled code,
otherwise use '<YOUR_DATABASE_NAME>' and 'YOUR_COLLECTION_NAME' placeholders.
Example:
User:
const collection = client.db('restaurant-stores').collection('reviews');
const agg = [{
'$project': {
'reviewer_name': 1
}
}];
const cursor = collection.aggregate(agg);
const reviews = await cursor.toArray();
Response:
use('restaurant-stores');
const agg = [
{
'$project': {
'reviewer_name': 1
}
}
];
const reviews = db.getCollection('reviews').aggregate(agg).toArray();
printjson(reviews);
Example:
User:
Expand Down

0 comments on commit 545207a

Please sign in to comment.