55[ ![ Downloads] ( https://img.shields.io/visual-studio-marketplace/d/taraskovalenko.csharp-package-autocomplete )] ( https://marketplace.visualstudio.com/items?itemName=taraskovalenko.csharp-package-autocomplete )
66[ ![ Rating] ( https://img.shields.io/visual-studio-marketplace/r/taraskovalenko.csharp-package-autocomplete )] ( https://marketplace.visualstudio.com/items?itemName=taraskovalenko.csharp-package-autocomplete )
77
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.
8+ Supercharge your C# top-level programs with intelligent NuGet package autocomplete! This extension provides seamless autocomplete for ` #:package ` , ` #:sdk ` , ` #:property ` directives.
9+ Complete IntelliSense support for .NET 10 file-based app directives in Visual Studio Code. Build and run ` C# ` applications directly from single ` .cs ` files with full autocomplete for packages, SDKs, and MSBuild properties.
910
1011![ alt text] ( image.png )
1112
@@ -24,118 +25,244 @@ To learn more about the war and how you can help, [click here](https://war.ukrai
2425
2526## ✨ Features
2627
27- ### 🔍 ** Smart Package Search **
28+ ### 📦 ** Package Management ( ` #:package ` ) **
2829- Type ` #:package ` and get instant autocomplete suggestions from the official NuGet repository
2930- Intelligent search with fuzzy matching for package names
3031- 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
32+ - Version management with ` @ ` syntax for easy version selection
33+ - Shows latest stable versions first (excludes pre-release by default)
34+
35+ ### 🛠️ ** SDK Selection (` #:sdk ` )**
36+ - Full autocomplete for .NET SDKs including:
37+ - ` Microsoft.NET.Sdk ` - Console applications and class libraries
38+ - ` Microsoft.NET.Sdk.Web ` - ASP.NET Core applications and Web APIs
39+ - ` Microsoft.NET.Sdk.Worker ` - Background services and hosted services
40+ - ` Microsoft.NET.Sdk.WindowsDesktop ` - WPF and Windows Forms applications
41+ - ` Microsoft.NET.Sdk.Razor ` - Razor class libraries and components
42+ - ` Microsoft.NET.Sdk.BlazorWebAssembly ` - Blazor WebAssembly applications
43+ - Rich documentation with SDK descriptions and default target frameworks
44+
45+ ### ⚙️ ** MSBuild Properties (` #:property ` )**
46+ - Intelligent autocomplete for common MSBuild properties:
47+ - ** LangVersion** - C# language version (` latest ` , ` preview ` , ` 12 ` , ` 11 ` , etc.)
48+ - ** TargetFramework** - Target framework (` net10.0 ` , ` net9.0 ` , ` net8.0 ` , etc.)
49+ - ** Nullable** - Nullable reference types (` enable ` , ` disable ` , ` warnings ` , ` annotations ` )
50+ - ** ImplicitUsings** - Implicit using statements (` enable ` , ` disable ` )
51+ - ** PublishAot** - Ahead-of-time compilation (` true ` , ` false ` )
52+ - ** TreatWarningsAsErrors** - Compiler warning handling
53+ - ** WarningLevel** - Compiler warning levels (0-5)
54+ - And many more...
55+ - Context-aware value suggestions with default values and descriptions
56+
57+ ### 📖 ** Rich Documentation & Hover Support**
58+ - Comprehensive hover information for all directive types
3959- Package descriptions, download counts, and direct links to NuGet
40- - Visual indicators for package popularity
60+ - SDK explanations with use cases and target frameworks
61+ - Property documentation with possible values and defaults
62+ - Visual indicators for package popularity and property defaults
4163
4264### ⚡ ** Performance Optimized**
4365- Intelligent caching reduces API calls and improves response time
4466- Non-blocking searches don't interrupt your coding flow
45- - Minimal resource usage
67+ - Minimal resource usage with smart request batching
4668
4769## 🚀 Getting Started
4870
4971### Installation
5072
51- 1 . Open VS Code
52- 2 . Go to Extensions (` Ctrl+Shift+X ` )
53- 3 . Search for "C# Package Autocomplete"
54- 4 . Click "Install"
73+ 1 . Install ** .NET 10 Preview 4** or later from [ dotnet.microsoft.com] ( https://dotnet.microsoft.com/download/dotnet/10.0 )
74+ 2 . Open ** Visual Studio Code**
75+ 3 . Go to Extensions (` Ctrl+Shift+X ` )
76+ 4 . Search for "C# File-Based App Directive Support"
77+ 5 . Click "Install"
5578
5679### Usage
5780
58811 . ** Create a C# file** with ` .cs ` extension
59- 2 . ** Type the package directive** :
82+ 2 . ** Type any directive** and get autocomplete :
6083 ``` csharp
61- #:package
84+ 85+ #:sdk Microsoft.NET.Sdk.Web
86+ #:property LangVersion preview
6287 ```
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
88+ 3 . ** Start typing** and see intelligent suggestions
89+ 4 . ** Run your script** with ` dotnet run yourfile.cs `
6690
6791## 📝 Examples
6892
69- ### Basic Usage
93+ ### Console Application with NuGet Package
7094``` csharp
71957296
7397using Humanizer ;
7498
75- var dotNet9Released = DateTimeOffset .Parse (" 2024-12-03 " );
76- var since = DateTimeOffset .Now - dotNet9Released ;
99+ var dotNet10Released = DateTimeOffset .Parse (" 2025-11-01 " );
100+ var since = DateTimeOffset .Now - dotNet10Released ;
77101
78- Console .WriteLine ($" It has been {since .Humanize ()} since .NET 9 was released." );
102+ Console .WriteLine ($" It has been {since .Humanize ()} since .NET 10 was released." );
79103```
80104
81- ### Multiple Packages
105+ ### ASP.NET Core Web API
82106``` csharp
83- 84- 85- 107+ #:sdk Microsoft.NET.Sdk.Web
108+ #:package Microsoft.AspNetCore.OpenApi@10.*-*
109+ #:property LangVersion preview
86110
87- using Newtonsoft .Json ;
88- using Serilog ;
89- using FluentValidation ;
111+ var builder = WebApplication .CreateBuilder ();
112+ builder .Services .AddOpenApi ();
113+
114+ var app = builder .Build ();
115+ app .MapOpenApi ();
116+
117+ app .MapGet (" /" , () => " Hello, World from .NET 10!" );
118+ app .MapGet (" /time" , () => new { Time = DateTime .Now , Message = " Current server time" });
119+
120+ app .Run ();
121+ ```
90122
91- // Your code here...
123+ ### Background Worker Service
124+ ``` csharp
125+ #:sdk Microsoft.NET.Sdk.Worker
126+ 127+
128+ var builder = Host .CreateApplicationBuilder (args );
129+ builder .Services .AddHostedService <WorkerService >();
130+
131+ var host = builder .Build ();
132+ await host .RunAsync ();
133+
134+ public class WorkerService : BackgroundService
135+ {
136+ protected override async Task ExecuteAsync (CancellationToken stoppingToken )
137+ {
138+ while (! stoppingToken .IsCancellationRequested )
139+ {
140+ Console .WriteLine ($" Worker running at: {DateTimeOffset .Now }" );
141+ await Task .Delay (1000 , stoppingToken );
142+ }
143+ }
144+ }
92145```
93146
94- ### Web API Example
147+ ### Advanced Configuration
95148``` csharp
96- 97- 149+ #:sdk Microsoft.NET.Sdk.Web
150+ #:package FluentValidation@*
151+ #:package FluentValidation.DependencyInjectionExtensions@*
152+ 153+ #:property LangVersion preview
154+ #:property Nullable enable
155+ #:property TreatWarningsAsErrors true
156+ #:property EnablePreviewFeatures true
157+
158+ using FluentValidation ;
159+ using Serilog ;
160+
161+ // Modern C# with preview features enabled
162+ Log .Logger = new LoggerConfiguration ()
163+ .WriteTo .Console ()
164+ .CreateLogger ();
98165
99166var builder = WebApplication .CreateBuilder (args );
167+ builder .Host .UseSerilog ();
168+ builder .Services .AddValidatorsFromAssemblyContaining <Program >();
169+
100170var app = builder .Build ();
101171
102- app .MapGet (" /" , () => " Hello World!" );
172+ app .MapPost (" /user" , async (CreateUserRequest request , IValidator <CreateUserRequest > validator ) =>
173+ {
174+ var result = await validator .ValidateAsync (request );
175+ return result .IsValid ? Results .Ok (" User created" ) : Results .BadRequest (result .Errors );
176+ });
177+
103178app .Run ();
179+
180+ public record CreateUserRequest (string Name , string Email );
181+
182+ public class CreateUserRequestValidator : AbstractValidator <CreateUserRequest >
183+ {
184+ public CreateUserRequestValidator ()
185+ {
186+ RuleFor (x => x .Name ).NotEmpty ().MaximumLength (100 );
187+ RuleFor (x => x .Email ).NotEmpty ().EmailAddress ();
188+ }
189+ }
190+ ```
191+
192+ ## 🎯 Directive Reference
193+
194+ ### ` #:package ` - NuGet Package References
195+ ``` csharp
196+ #:package PackageName@Version
197+ 198+ #:package Microsoft.Extensions.Hosting@8.*
199+ ```
200+
201+ ### ` #:sdk ` - SDK Selection
202+ ``` csharp
203+ #:sdk Microsoft.NET.Sdk // Console/Library (default)
204+ #:sdk Microsoft.NET.Sdk.Web // ASP.NET Core
205+ #:sdk Microsoft.NET.Sdk.Worker // Background Services
206+ #:sdk Microsoft.NET.Sdk.WindowsDesktop // WPF/WinForms
207+ ```
208+
209+ ### `#:property` - MSBuild Properties
210+ ```csharp
211+ #:property LangVersion preview // C# language version
212+ #:property TargetFramework net10.0 // Target framework
213+ #:property Nullable enable // Nullable reference types
214+ #:property ImplicitUsings enable // Implicit usings
215+ #:property PublishAot true // AOT compilation
104216 ```
105217
106218## ⚙️ Configuration
107219
108220No configuration needed ! The extension works out of the box with sensible defaults .
109221
110- ### Settings ( Optional)
222+ ### Optional Settings
111223
112224Future versions may include these customizable settings :
113225
114226- Cache duration for package searches
115227- Number of suggestions to display
116228- Include/exclude pre-release packages
117229- Custom package source URLs
230+ - Additional MSBuild properties
118231
119232## 🔧 Requirements
120233
121- - ** Visual Studio Code** 1.74.0 or higher
234+ - **Visual Studio Code** 1.103.0 or higher
235+ - **.NET 10 Preview 4** or later with file-based app support
236+ - **C# Dev Kit extension** (recommended) for best experience
122237- **Internet connection** for package search (cached results work offline )
123- - ** .NET SDK** with top-level program support
238+
239+ ### VS Code Setup for File-Based Apps
240+
241+ 1 . Install the ** C # Dev Kit ** extension
242+ 2 . Switch to ** Pre - Release version ** of the C # extension (version 2.79.8 + )
243+ 3 . Ensure you have ** .NET 10 Preview 4 ** installed
124244
125245## 🐛 Known Issues
126246
127247- ** Network dependency ** : Requires internet connection for initial package searches
128248- **API rate limits**: Heavy usage might temporarily reduce suggestion speed
129249- **Case sensitivity**: Package names are case-sensitive in NuGet
250+ - **SDK validation**: Some custom SDKs may not be recognized for autocomplete
130251
131252## 📋 Roadmap
132253
133- - [ ] ** Custom package sources** - Support for private NuGet feeds
134- - [ ] ** Dependency visualization** - Show package dependencies
254+ ### Short Term
255+ - [ ] **Custom package sources** - Support for private NuGet feeds and Azure Artifacts
256+ - [ ] **Enhanced property validation** - Real-time validation of property values
257+ - [ ] **Project conversion hints** - Suggestions for converting to full projects
258+
259+ ### Long Term
260+ - [ ] **Dependency visualization** - Show package dependency trees
135261- [ ] **Version comparison** - Compare versions with changelogs
136262- [ ] **Package templates** - Quick scaffolding for common scenarios
137- - [ ] ** Offline mode** - Offline package suggestions
138- - [ ] ** IntelliSense integration** - Enhanced code completion for imported packages
263+ - [ ] **Offline mode** - Enhanced offline package suggestions
264+ - [ ] **Multi-file support** - Support for file-based apps with multiple files
265+ - [ ] **Debug support** - Enhanced debugging experience for file-based apps
139266
140267## 🤝 Contributing
141268
@@ -145,23 +272,44 @@ We welcome contributions! Here's how you can help:
1452722. **Request features** through GitHub discussions
1462733. **Submit pull requests** for bug fixes or new features
1472744. **Share feedback** and rate the extension
275+ 5. **Add SDK or property definitions** for better autocomplete coverage
148276
149277### Development Setup
150278
151279```bash
152280# Clone the repository
153- git clone https://github.com/TarasKovalenko/csharp-package-autocomplete
281+ git clone https://github.com/TarasKovalenko/csharp-filebased-directive-support
154282
155283# Install dependencies
156284npm ci
157285
158286# Compile TypeScript
159287npm run compile
160288
289+ # Run tests
290+ npm test
291+
161292# Package extension
162293npm run package
163294```
164295
296+ ### Testing File-Based Apps
297+
298+ Create test files and run them:
299+
300+ ```bash
301+ # Create a test file
302+ 303+ using Humanizer;
304+ Console .WriteLine (" Hello" .Humanize ());' > test.cs
305+
306+ # Run with .NET 10
307+ dotnet run test .cs
308+
309+ # Convert to project when ready
310+ dotnet project convert test .cs
311+ ```
312+
165313## 📄 License
166314
167315This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
@@ -173,16 +321,25 @@ If you find this extension helpful:
173321- ⭐ ** Star the repository** on GitHub
174322- 📝 ** Leave a review** on the VS Code Marketplace
175323- 🐦 ** Share it** with your fellow developers
324+ - 💬 ** Join discussions** about .NET 10 file-based apps
176325
177326## 🙏 Acknowledgments
178327
179- - ** Microsoft** for the amazing .NET ecosystem and top-level programs feature
328+ - ** Microsoft .NET Team ** for the innovative file-based apps feature in .NET 10
180329- ** NuGet team** for the comprehensive package API
181330- ** VS Code team** for the excellent extension platform
182- - ** Community** for feedback and contributions
331+ - ** C# Dev Kit team** for the enhanced C# experience
332+ - ** Community** for feedback, bug reports, and feature requests
183333
184334---
185335
186- ** Happy coding with C# and NuGet packages!** 🚀
336+ ** Transform your C# development with single-file simplicity!** 🚀
337+
338+ * Made with ❤️ for the .NET community*
339+
340+ ## 🔗 Related Links
187341
188- * Made with ❤️ for the .NET community*
342+ - [ .NET 10 File-Based Apps Documentation] ( https://docs.microsoft.com/en-us/dotnet/core/tutorials/file-based-apps )
343+ - [ .NET 10 Preview Downloads] ( https://dotnet.microsoft.com/download/dotnet/10.0 )
344+ - [ C# Dev Kit Extension] ( https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit )
345+ - [ MSBuild Property Reference] ( https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props )
0 commit comments