C# Package Autocomplete

Supercharge your C# top-level programs with intelligent NuGet package autocomplete! This extension provides seamless autocomplete for #:package
directives, making it effortless to add and manage NuGet packages in your C# scripts.

Terms of use
By using this project or its source code, for any purpose and in any shape or form, you grant your implicit agreement to all of the following statements:
- You unequivocally condemn Russia and its military aggression against Ukraine
- You recognize that Russia is an occupant that unlawfully invaded a sovereign state
- You agree that Russia is a terrorist state
- You fully support Ukraine's territorial integrity, including its claims
over temporarily occupied territories
- You reject false narratives perpetuated by Russian state propaganda
To learn more about the war and how you can help, click here. Glory to Ukraine! 🇺🇦
✨ Features
🔍 Smart Package Search
- Type
#:package
and get instant autocomplete suggestions from the official NuGet repository
- Intelligent search with fuzzy matching for package names
- Real-time package information with descriptions and download statistics
🏷️ Version Management
- Type
@
after a package name to get version suggestions
- Shows latest stable versions first (excludes pre-release)
- Easy selection from available version history
📖 Rich Documentation
- Hover over any package to see detailed information
- Package descriptions, download counts, and direct links to NuGet
- Visual indicators for package popularity
- Intelligent caching reduces API calls and improves response time
- Non-blocking searches don't interrupt your coding flow
- Minimal resource usage
🚀 Getting Started
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X
)
- Search for "C# Package Autocomplete"
- Click "Install"
Usage
- Create a C# file with
.cs
extension
- Type the package directive:
#:package
- Start typing a package name and see autocomplete suggestions
- Add version by typing
@
after the package name
- Run your script with the new .NET CLI
📝 Examples
Basic Usage
#:package Humanizer@2.14.1
using Humanizer;
var dotNet9Released = DateTimeOffset.Parse("2024-12-03");
var since = DateTimeOffset.Now - dotNet9Released;
Console.WriteLine($"It has been {since.Humanize()} since .NET 9 was released.");
Multiple Packages
#:package Newtonsoft.Json@13.0.3
#:package Serilog@3.1.1
#:package FluentValidation@11.8.0
using Newtonsoft.Json;
using Serilog;
using FluentValidation;
// Your code here...
Web API Example
#:package Microsoft.AspNetCore.App@8.0.0
#:package Swashbuckle.AspNetCore@6.5.0
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
⚙️ Configuration
No configuration needed! The extension works out of the box with sensible defaults.
Settings (Optional)
Future versions may include these customizable settings:
- Cache duration for package searches
- Number of suggestions to display
- Include/exclude pre-release packages
- Custom package source URLs
🔧 Requirements
- Visual Studio Code 1.74.0 or higher
- Internet connection for package search (cached results work offline)
- .NET SDK with top-level program support
🐛 Known Issues
- Network dependency: Requires internet connection for initial package searches
- API rate limits: Heavy usage might temporarily reduce suggestion speed
- Case sensitivity: Package names are case-sensitive in NuGet
📋 Roadmap
- [ ] Custom package sources - Support for private NuGet feeds
- [ ] Dependency visualization - Show package dependencies
- [ ] Version comparison - Compare versions with changelogs
- [ ] Package templates - Quick scaffolding for common scenarios
- [ ] Offline mode - Offline package suggestions
- [ ] IntelliSense integration - Enhanced code completion for imported packages
🤝 Contributing
We welcome contributions! Here's how you can help:
- Report bugs by creating issues on GitHub
- Request features through GitHub discussions
- Submit pull requests for bug fixes or new features
- Share feedback and rate the extension
Development Setup
# Clone the repository
git clone https://github.com/TarasKovalenko/csharp-package-autocomplete
# Install dependencies
npm ci
# Compile TypeScript
npm run compile
# Package extension
npm run package
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
💝 Support
If you find this extension helpful:
- ⭐ Star the repository on GitHub
- 📝 Leave a review on the VS Code Marketplace
- 🐦 Share it with your fellow developers
🙏 Acknowledgments
- Microsoft for the amazing .NET ecosystem and top-level programs feature
- NuGet team for the comprehensive package API
- VS Code team for the excellent extension platform
- Community for feedback and contributions
Happy coding with C# and NuGet packages! 🚀
Made with ❤️ for the .NET community