Skip to content

Commit 16c4204

Browse files
authored
feat(chat): add VSCode Copilot MongoDB chat participant VSCODE-528
2 parents a7dbbb1 + 547e455 commit 16c4204

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+8786
-483
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
out
33
dist
44
scripts
5+
src/vscode-dts

.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ module.exports = {
6363
'error',
6464
{ prefer: 'type-imports' },
6565
],
66+
'@typescript-eslint/explicit-function-return-type': [
67+
'warn',
68+
{
69+
allowHigherOrderFunctions: true,
70+
},
71+
],
6672
},
6773
parserOptions: {
6874
project: ['./tsconfig.json'], // Specify it only for TypeScript files.

.github/workflows/actions/test-and-build/action.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ runs:
7070
shell: bash
7171

7272
- name: Run Tests
73+
env:
74+
NODE_OPTIONS: "--max_old_space_size=4096"
7375
run: |
7476
npm run test
7577
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ constants.json
1010
.env
1111
.eslintcache
1212
.sbom
13+
src/test/ai-accuracy-tests/test-results.html

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"--extensionDevelopmentPath=${workspaceFolder}"
1515
],
1616
"outFiles": [
17-
"${workspaceFolder}/out/**/*.js"
17+
"${workspaceFolder}/dist/**/*.js"
1818
],
1919
"preLaunchTask": "${defaultBuildTask}"
2020
},

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ npm run watch
3535

3636
2. Inside of [VS Code Insiders](https://code.visualstudio.com/insiders/) open this directory and press `F5` to begin debugging the extension. This should launch a new VSCode window which is running the extension.
3737

38+
### Using Proposed API
39+
40+
The vscode extension will occasionally need to use [proposed API](https://code.visualstudio.com/api/advanced-topics/using-proposed-api) that haven't been promoted to stable yet. To enable an API proposal, add it to the `enabledApiProposals` section in `package.json`, then run `cd src/vscode-dts && npx @vscode/dts dev` to install the type definitions for the API you want to enable.
41+
42+
**Note**: Using proposed API is only possible during local development and will prevent publishing the extension.
43+
3844
#### Code Tour
3945

4046
- `out` Compiled extension code

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ Connect to Atlas Stream Processing instances and develop stream processors using
7777

7878
![Atlas Stream Processing Playground](resources/screenshots/atlas-stream-processing.png)
7979

80+
### MongoDB Copilot Participant
81+
82+
Use natural language to interact with your clusters and generate MongoDB-related code with GitHub Copilot Chat in VS Code.
83+
84+
_Note: To use the MongoDB Participant, you must have the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension. By using Copilot Chat you agree to [GitHub Copilot chat preview terms](https://docs.github.com/en/copilot/responsible-use-of-github-copilot-features/responsible-use-of-github-copilot-chat-in-your-ide). Find more details about the MongoDB GenAI Features in the [FAQ](https://www.mongodb.com/docs/generative-ai-faq/)._
85+
86+
#### How to use the MongoDB Participant
87+
88+
1. Enter `@MongoDB` in the chat input field to start a conversation with the MongoDB Participant.
89+
90+
![MongoDB Participant](resources/screenshots/mongodb-participant.png)
91+
92+
2. Start typing `/` in the chat window to get the list of available chat participant commands.
93+
94+
![MongoDB Participant Commands](resources/screenshots/mongodb-participant-commands.png)
95+
96+
- `/docs` is a participant command that finds answers to coding-related questions in the [MongoDB documentation](https://www.mongodb.com/docs/).
97+
- `/query` is a participant command that generates MongoDB queries from natural language to be used with a connected MongoDB cluster. It generates both queries and aggregations depending on the complexity of the request. It utilizes schema to reduce model hallucinations. It provides a code action to open generated code in a playground and an action to directly run the code from the Copilot chat interface.
98+
- `/schema` is a participant command that analyzes and returns information about a collection's schema.
8099

81100
## Extension Settings
82101

@@ -88,6 +107,8 @@ Connect to Atlas Stream Processing instances and develop stream processors using
88107
| `mdb.showMongoDBHelpExplorer` | Show or hide the MongoDB Help panel. | `true` |
89108
| `mdb.defaultLimit` | The number of documents to fetch when viewing documents from a collection. | `10` |
90109
| `mdb.confirmRunAll` | Show a confirmation message before running commands in a playground. | `true` |
110+
| `mdb.confirmRunCopilotCode` | Show a confirmation message before running code generated by the MongoDB participant. | `true` |
111+
| `mdb.useSampleDocsInCopilot` | Enable sending sample field values with the VSCode copilot chat @MongoDB participant /query command. | `false` |
91112
| `mdb.confirmDeleteDocument` | Show a confirmation message before deleting a document in the tree view. | `true` |
92113
| `mdb.persistOIDCTokens` | Remain logged in when using the MONGODB-OIDC authentication mechanism for MongoDB server connection. Access tokens are encrypted using the system keychain before being stored. | `true` |
93114
| `mdb.showOIDCDeviceAuthFlow` | Opt-in and opt-out for diagnostic and telemetry collection. | `true` |
@@ -97,6 +118,8 @@ Connect to Atlas Stream Processing instances and develop stream processors using
97118
| `mdb.useDefaultTemplateForPlayground` | Choose whether to use the default template for playground files or to start with an empty playground editor. | `true` |
98119
| `mdb.uniqueObjectIdPerCursor` | The default behavior is to generate a single ObjectId and insert it on all cursors. Set to true to generate a unique ObjectId per cursor instead. | `false` |
99120
| `mdb.sendTelemetry` | Opt-in and opt-out for diagnostic and telemetry collection. | `true` |
121+
| `mdb.confirmRunCopilotCode` | Show a confirmation message before running code generated by the MongoDB participant. | `true` |
122+
| `mdb.useSampleDocsInCopilot` | Enable sending sample field values with the VSCode copilot chat @MongoDB participant /query command. | `false` |
100123

101124
## Additional Settings
102125

0 commit comments

Comments
 (0)