microsoft / microsoft/TypeScript
VS Code doesn't show autocomplete for Mongoose MongoDB operators (like $elemMatch, $match,$gte and ...) in JavaScript, while WebStorm does
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.3k
- Merge trung bình
- 2 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 132
Mô tả
Problem
When working with Mongoose in JavaScript (not TypeScript), VS Code does not show autocomplete suggestions for common MongoDB operators like $inc, $eq, $ne, etc.
However, when using WebStorm, these suggestions appear as expected.
Example
const result = await User.find({
$or: [
{ userName: { $elemMatch: { name: "Mehdi" } } },
{ age: { $gte: 18 } }
]
});
In the above example, $or doesn't appear in suggestions while typing in VS Code, but it does in WebStorm.
What I Know
I understand that VS Code relies heavily on TypeScript's language service for JavaScript intelligence.
But since this is a common pattern in many Node.js/Mongoose applications, I'm wondering:
Is there a way to configure VS Code (via jsconfig.json, type acquisition, or something else) to provide better autocomplete for these $ MongoDB operators in plain JavaScript files?
Environment
VS Code: latest
Language mode: JavaScript
Mongoose version: latest
Node.js version: 21
OS: Windows
Thanks for the awesome editor 🙌
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện các gợi ý còn thiếu trong một tệp JavaScript đơn giản bằng truy vấn Mongoose từ issue. Điều tra jsconfig.json được đề cập, việc thu nhận kiểu và hành vi của TypeScript language service; hoàn thành nghĩa là xác định liệu cấu hình hoặc khả năng hỗ trợ của language service có thể cung cấp tính năng hoàn thành toán tử MongoDB hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, mongodb, node.js, typescript
- Lĩnh vực
- backend, databases, developer-experience
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100