Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

mongodb-js/vscode-mongodb-language

Repository files navigation

VSCode MongoDB Language Extension

The MongoDB language support for VSCode extensions.

example

The MongoDB language is built for the official MongoDB VSCode plugin that introduces a new .mongodb extension for its playground, but can be used as a MongoDB language support by any other plugin that uses the .mongodb extension.

How to install

The MongoDB Language Extension is not released yet. To start using this extension with VSCode copy it into the <user home>/.vscode/extensions folder and restart VSCode.

syntaxes/mongodb.tmLanguage.json

The MongoDB Shell language is a JavaScript-based query language that supports extended JSON, also called BSON.

The mongodb.tmLanguage.json file is derived from TypeScript.tmLanguage and injected with MongoDB symbols from mongodb-symbols.json.

If you download a new version of the TypeScript grammar or update the MongoDB symbols you should update the MongoDB grammar by running the script:

npm run update-grammar

The script does the following changes:

  • Parses the TypeScript.tmLanguage plist and builds mongodb.tmLanguage.json.
  • Updates .ts file types, rule names and scope to .mongodb.
  • Injects the mongodb.tmLanguage.json grammar with MongoDB symbols.

Compare uuid in TypeScript.tmLanguage and mongodb.tmLanguage.json to verify that a proper version of the grammar is being used.

syntaxes/mongodb-symbols.json

The mongodb-symbols.json file contains symbols that are defined in mongodb-ace-mode.

Note: ACE supports the importing of .tmtheme and .tmlanguage files for use in the editor. Probably vscode-mongodb-language can be a source of truth for other projects instead of requiring symbols from mongodb-ace-mode.