Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mongo as a VS Code supported language #6848

Merged
merged 4 commits into from Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.unreleased.md
Expand Up @@ -692,7 +692,7 @@ Previously, Prettier only supported the most common HTML entities, such as `&nbs
[error] stdin: SyntaxError: Unknown entity "excl" - use the "&#<decimal>;" or "&#x<hex>;" syntax (1:6)
[error] > 1 | <p>Hi&excl;</p>
[error] | ^
[error] 2 |
[error] 2 |
-->

<!-- Output (Prettier master) -->
Expand Down Expand Up @@ -1365,6 +1365,14 @@ const bigints = [200000n, 0x0000000an, 0b01111111n];
const bigints = [200_000n, 0x0000_000an, 0b0111_1111n];
```

#### VS Code: add support for .mongo files ([#6848] by [@aymericbouzy])

When using the Azure Cosmos DB extension for VS Code, you can create .mongo files to write MongoDB queries, which use Javascript syntax. This change allows VS Code to format your file using Prettier.

```js
db.users.find({ someField: { $exists: true } });
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you format changelog item as we do in others?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this makes sense in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that what you mean?

<!-- prettier-ignore -->
```js
// Input
db.users.find({someField:{$exists: true}});

// Output
db.users.find({ someField: { $exists: true } });
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, but maybe we really can simplify it here as you do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not making any change unless you tell me to 😄 I believe too it's not really necessary in this case.


[#5682]: https://github.com/prettier/prettier/pull/5682
[#6657]: https://github.com/prettier/prettier/pull/6657
[#5910]: https://github.com/prettier/prettier/pull/5910
Expand Down Expand Up @@ -1413,6 +1421,7 @@ const bigints = [200_000n, 0x0000_000an, 0b0111_1111n];
[#6708]: https://github.com/prettier/prettier/pull/6708
[#6687]: https://github.com/prettier/prettier/pull/6687
[#6796]: https://github.com/prettier/prettier/pull/6796
[#6848]: https://github.com/prettier/prettier/pull/6848
[@brainkim]: https://github.com/brainkim
[@duailibe]: https://github.com/duailibe
[@gavinjoyce]: https://github.com/gavinjoyce
Expand All @@ -1433,3 +1442,4 @@ const bigints = [200_000n, 0x0000_000an, 0b0111_1111n];
[@voithos]: https://github.com/voithos
[@andersk]: https://github.com/andersk
[@lydell]: https://github.com/lydell
[@aymericbouzy]: https://github.com/aymericbouzy
2 changes: 1 addition & 1 deletion src/language-js/index.js
Expand Up @@ -10,7 +10,7 @@ const languages = [
Object.assign(data, {
since: "0.0.0",
parsers: ["babel", "flow"],
vscodeLanguageIds: ["javascript"],
vscodeLanguageIds: ["javascript", "mongo"],
interpreters: data.interpreters.concat(["nodejs"])
})
),
Expand Down
Expand Up @@ -698,7 +698,7 @@ exports[`CLI --support-info (stdout) 1`] = `
\\"since\\": \\"0.0.0\\",
\\"tmScope\\": \\"source.js\\",
\\"type\\": \\"programming\\",
\\"vscodeLanguageIds\\": [\\"javascript\\"]
\\"vscodeLanguageIds\\": [\\"javascript\\", \\"mongo\\"]
},
{
\\"aceMode\\": \\"javascript\\",
Expand Down