Skip to content

Commit

Permalink
Fix Camera analyzer (#1996)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis authored Jul 3, 2024
1 parent 819ab10 commit 7946d9c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Initialize .NET MAUI Community Toolkit CameraView Before UseMauiApp" xml:space="preserve">
<data name="Initialize .NET MAUI Community Toolkit Camera Before UseMauiApp" xml:space="preserve">
<value>Add `.UseMauiCommunityToolkitCamera()`</value>
<comment>Add `.UseMauiCommunityToolkitCamera()`</comment>
</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Immutable;
using System.Composition;
using CommunityToolkit.Maui.CameraView.Analyzers;
using CommunityToolkit.Maui.Camera.Analyzers;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
Expand All @@ -10,8 +10,8 @@

namespace CommunityToolkit.Maui.Camera.Analyzers;

[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(UseCommunityToolkitCameraViewInitializationAnalyzerCodeFixProvider)), Shared]
public class UseCommunityToolkitCameraViewInitializationAnalyzerCodeFixProvider : CodeFixProvider
[ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(UseCommunityToolkitCameraInitializationAnalyzerCodeFixProvider)), Shared]
public class UseCommunityToolkitCameraInitializationAnalyzerCodeFixProvider : CodeFixProvider
{
public sealed override ImmutableArray<string> FixableDiagnosticIds { get; } = ImmutableArray.Create(UseCommunityToolkitCameraInitializationAnalyzer.DiagnosticId);

Expand All @@ -30,9 +30,9 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
// Register a code action that will invoke the fix.
context.RegisterCodeFix(
CodeAction.Create(
title: CodeFixResources.Initialize__NET_MAUI_Community_Toolkit_CameraView_Before_UseMauiApp,
title: CodeFixResources.Initialize__NET_MAUI_Community_Toolkit_Camera_Before_UseMauiApp,
createChangedDocument: c => AddUseCommunityToolkit(context.Document, declaration, c),
equivalenceKey: nameof(CodeFixResources.Initialize__NET_MAUI_Community_Toolkit_CameraView_Before_UseMauiApp)),
equivalenceKey: nameof(CodeFixResources.Initialize__NET_MAUI_Community_Toolkit_Camera_Before_UseMauiApp)),
diagnostic);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/CommunityToolkit.Maui.Camera.Analyzers/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<value>`.UseMauiCommunityToolkitCamera()` must be chained to `.UseMauiApp&lt;T&gt;()`</value>
</data>
<data name="InitializationErrorMessage" xml:space="preserve">
<value>`.UseMauiCommunityToolkitCamera()` is required to initalize .NET MAUI Community Toolkit CameraView</value>
<value>`.UseMauiCommunityToolkitCamera()` is required to initalize .NET MAUI Community Toolkit Camera</value>
</data>
<data name="InitializationErrorTitle" xml:space="preserve">
<value>`.UseMauiCommunityToolkitCamera()` Not Found on MauiAppBuilder</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;

namespace CommunityToolkit.Maui.CameraView.Analyzers;
namespace CommunityToolkit.Maui.Camera.Analyzers;

[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class UseCommunityToolkitCameraInitializationAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticId = "MCTME001";
public const string DiagnosticId = "MCTC001";

const string category = "Initialization";
static readonly LocalizableString title = new LocalizableResourceString(nameof(Resources.InitializationErrorTitle), Resources.ResourceManager, typeof(Resources));
Expand Down

0 comments on commit 7946d9c

Please sign in to comment.