|
1 | | -# csharp-package-autocomplete |
2 | | -Provides autocomplete for #:package directives in C# files |
| 1 | +# C# Package Autocomplete |
| 2 | + |
| 3 | +[](https://taraskovalenko.github.io/) |
| 4 | +[](https://marketplace.visualstudio.com/items?itemName=taraskovalenko.csharp-package-autocomplete) |
| 5 | +[](https://marketplace.visualstudio.com/items?itemName=taraskovalenko.csharp-package-autocomplete) |
| 6 | +[](https://marketplace.visualstudio.com/items?itemName=taraskovalenko.csharp-package-autocomplete) |
| 7 | + |
| 8 | +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. |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Terms of use |
| 13 | + |
| 14 | +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: |
| 15 | + |
| 16 | +- You unequivocally condemn Russia and its military aggression against Ukraine |
| 17 | +- You recognize that Russia is an occupant that unlawfully invaded a sovereign state |
| 18 | +- You agree that [Russia is a terrorist state](https://www.europarl.europa.eu/doceo/document/RC-9-2022-0482_EN.html) |
| 19 | +- You fully support Ukraine's territorial integrity, including its claims |
| 20 | + over [temporarily occupied territories](https://en.wikipedia.org/wiki/Russian-occupied_territories_of_Ukraine) |
| 21 | +- You reject false narratives perpetuated by Russian state propaganda |
| 22 | + |
| 23 | +To learn more about the war and how you can help, [click here](https://war.ukraine.ua/). Glory to Ukraine! 🇺🇦 |
| 24 | + |
| 25 | +## ✨ Features |
| 26 | + |
| 27 | +### 🔍 **Smart Package Search** |
| 28 | +- Type `#:package` and get instant autocomplete suggestions from the official NuGet repository |
| 29 | +- Intelligent search with fuzzy matching for package names |
| 30 | +- Real-time package information with descriptions and download statistics |
| 31 | + |
| 32 | +### 🏷️ **Version Management** |
| 33 | +- Type `@` after a package name to get version suggestions |
| 34 | +- Shows latest stable versions first (excludes pre-release) |
| 35 | +- Easy selection from available version history |
| 36 | + |
| 37 | +### 📖 **Rich Documentation** |
| 38 | +- Hover over any package to see detailed information |
| 39 | +- Package descriptions, download counts, and direct links to NuGet |
| 40 | +- Visual indicators for package popularity |
| 41 | + |
| 42 | +### ⚡ **Performance Optimized** |
| 43 | +- Intelligent caching reduces API calls and improves response time |
| 44 | +- Non-blocking searches don't interrupt your coding flow |
| 45 | +- Minimal resource usage |
| 46 | + |
| 47 | +## 🚀 Getting Started |
| 48 | + |
| 49 | +### Installation |
| 50 | + |
| 51 | +1. Open VS Code |
| 52 | +2. Go to Extensions (`Ctrl+Shift+X`) |
| 53 | +3. Search for "C# Package Autocomplete" |
| 54 | +4. Click "Install" |
| 55 | + |
| 56 | +### Usage |
| 57 | + |
| 58 | +1. **Create a C# file** with `.cs` extension |
| 59 | +2. **Type the package directive**: |
| 60 | + ```csharp |
| 61 | + #:package |
| 62 | + ``` |
| 63 | +3. **Start typing a package name** and see autocomplete suggestions |
| 64 | +4. **Add version** by typing `@` after the package name |
| 65 | +5. **Run your script** with the new .NET CLI |
| 66 | + |
| 67 | +## 📝 Examples |
| 68 | + |
| 69 | +### Basic Usage |
| 70 | +```csharp |
| 71 | + |
| 72 | + |
| 73 | +using Humanizer; |
| 74 | + |
| 75 | +var dotNet9Released = DateTimeOffset.Parse("2024-12-03"); |
| 76 | +var since = DateTimeOffset.Now - dotNet9Released; |
| 77 | + |
| 78 | +Console.WriteLine($"It has been {since.Humanize()} since .NET 9 was released."); |
| 79 | +``` |
| 80 | + |
| 81 | +### Multiple Packages |
| 82 | +```csharp |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +using Newtonsoft.Json; |
| 88 | +using Serilog; |
| 89 | +using FluentValidation; |
| 90 | + |
| 91 | +// Your code here... |
| 92 | +``` |
| 93 | + |
| 94 | +### Web API Example |
| 95 | +```csharp |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +var builder = WebApplication.CreateBuilder(args); |
| 100 | +var app = builder.Build(); |
| 101 | + |
| 102 | +app.MapGet("/", () => "Hello World!"); |
| 103 | +app.Run(); |
| 104 | +``` |
| 105 | + |
| 106 | +## ⚙️ Configuration |
| 107 | + |
| 108 | +No configuration needed! The extension works out of the box with sensible defaults. |
| 109 | + |
| 110 | +### Settings (Optional) |
| 111 | + |
| 112 | +Future versions may include these customizable settings: |
| 113 | + |
| 114 | +- Cache duration for package searches |
| 115 | +- Number of suggestions to display |
| 116 | +- Include/exclude pre-release packages |
| 117 | +- Custom package source URLs |
| 118 | + |
| 119 | +## 🔧 Requirements |
| 120 | + |
| 121 | +- **Visual Studio Code** 1.74.0 or higher |
| 122 | +- **Internet connection** for package search (cached results work offline) |
| 123 | +- **.NET SDK** with top-level program support |
| 124 | + |
| 125 | +## 🐛 Known Issues |
| 126 | + |
| 127 | +- **Network dependency**: Requires internet connection for initial package searches |
| 128 | +- **API rate limits**: Heavy usage might temporarily reduce suggestion speed |
| 129 | +- **Case sensitivity**: Package names are case-sensitive in NuGet |
| 130 | + |
| 131 | +## 📋 Roadmap |
| 132 | + |
| 133 | +- [ ] **Custom package sources** - Support for private NuGet feeds |
| 134 | +- [ ] **Dependency visualization** - Show package dependencies |
| 135 | +- [ ] **Version comparison** - Compare versions with changelogs |
| 136 | +- [ ] **Package templates** - Quick scaffolding for common scenarios |
| 137 | +- [ ] **Offline mode** - Offline package suggestions |
| 138 | +- [ ] **IntelliSense integration** - Enhanced code completion for imported packages |
| 139 | + |
| 140 | +## 🤝 Contributing |
| 141 | + |
| 142 | +We welcome contributions! Here's how you can help: |
| 143 | + |
| 144 | +1. **Report bugs** by creating issues on GitHub |
| 145 | +2. **Request features** through GitHub discussions |
| 146 | +3. **Submit pull requests** for bug fixes or new features |
| 147 | +4. **Share feedback** and rate the extension |
| 148 | + |
| 149 | +### Development Setup |
| 150 | + |
| 151 | +```bash |
| 152 | +# Clone the repository |
| 153 | +git clone https://github.com/TarasKovalenko/csharp-package-autocomplete |
| 154 | + |
| 155 | +# Install dependencies |
| 156 | +npm ci |
| 157 | + |
| 158 | +# Compile TypeScript |
| 159 | +npm run compile |
| 160 | + |
| 161 | +# Package extension |
| 162 | +npm run package |
| 163 | +``` |
| 164 | + |
| 165 | +## 📄 License |
| 166 | + |
| 167 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 168 | + |
| 169 | +## 💝 Support |
| 170 | + |
| 171 | +If you find this extension helpful: |
| 172 | + |
| 173 | +- ⭐ **Star the repository** on GitHub |
| 174 | +- 📝 **Leave a review** on the VS Code Marketplace |
| 175 | +- 🐦 **Share it** with your fellow developers |
| 176 | + |
| 177 | +## 🙏 Acknowledgments |
| 178 | + |
| 179 | +- **Microsoft** for the amazing .NET ecosystem and top-level programs feature |
| 180 | +- **NuGet team** for the comprehensive package API |
| 181 | +- **VS Code team** for the excellent extension platform |
| 182 | +- **Community** for feedback and contributions |
| 183 | + |
| 184 | +--- |
| 185 | + |
| 186 | +**Happy coding with C# and NuGet packages!** 🚀 |
| 187 | + |
| 188 | +*Made with ❤️ for the .NET community* |
0 commit comments