-
Notifications
You must be signed in to change notification settings - Fork 221
Move samples into services and remove language resolver #12975
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
base: main
Are you sure you want to change the base?
Conversation
…age resolver interface
…age resolver interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restructures the sample generation architecture to consolidate sample-related code within the language services directory and eliminates the language-specific resolver pattern. The changes simplify the dependency injection model by making SampleLanguageContext a property directly accessible from each LanguageService instead of requiring resolution through a separate service.
- Moved all sample generation classes from
Azure.Sdk.Tools.Cli.SamplestoAzure.Sdk.Tools.Cli.Services.Languages.Samples.SampleGenerationnamespace - Removed the
ILanguageSpecificResolver<T>and its implementation, eliminating dynamic language detection logic - Added
SampleLanguageContextas a property onLanguageServicebase class, instantiated via a switch expression - Updated all
LanguageServiceimplementations to acceptIFileHelperin their constructors
Reviewed Changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| SampleTranslatorTool.cs | Removed dependency on ILanguageSpecificResolver, now accesses SampleLanguageContext directly from language services |
| SampleGeneratorTool.cs | Removed dependency on ILanguageSpecificResolver, simplified constructor |
| ServiceRegistrations.cs | Removed registration of language-specific resolver for SampleLanguageContext |
| LanguageService.cs | Added SampleLanguageContext property with factory pattern and IFileHelper field |
| *LanguageService.cs (all languages) | Updated constructors to accept IFileHelper parameter |
| SampleGeneration/*.cs | Namespace changed from Azure.Sdk.Tools.Cli.Samples to Azure.Sdk.Tools.Cli.Services.Languages.Samples.SampleGeneration |
| SampleConstants.cs | Namespace updated to match new location |
| LanguageSpecificResolver.cs | File deleted - resolver pattern removed |
| ILanguageSpecificResolver.cs | File deleted - interface removed |
| LanguageSpecificExtensions.cs | File deleted - extension methods for resolver removed |
| Test files | Updated to pass IFileHelper mock to all LanguageService constructors, removed resolver mocking |
Comments suppressed due to low confidence (4)
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/Samples/SampleGeneration/GoSourceInputProvider.cs:6
- Duplicate copyright headers detected. Lines 1-3 contain a copyright header, and lines 4-6 duplicate it. Remove the duplicate lines 4-6.
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/Samples/SampleGeneration/GoSampleLanguageContext.cs:6 - Duplicate copyright headers detected. Lines 1-3 contain a copyright header, and lines 4-6 duplicate it. Remove the duplicate lines 4-6.
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/Samples/SampleGeneration/DotNetSampleLanguageContext.cs:6 - Duplicate copyright headers detected. Lines 1-3 contain a copyright header, and lines 4-6 duplicate it. Remove the duplicate lines 4-6.
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/Samples/SampleGeneration/ILanguageSourceInputProvider.cs:6 - Duplicate copyright headers detected. Lines 1-3 contain a copyright header, and lines 4-6 duplicate it. Remove the duplicate lines 4-6.
Samples restructure to follow the pattern used by language service.