diff --git a/src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs b/src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs index b5755bc9ee137c0625a85ad39be8b19e42dc2215..7f9125221fcc3410e466f668e40cd84ed51e1e74 100644 --- a/src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs +++ b/src/EditorFeatures/Core/Implementation/Suggestions/SuggestedAction.cs @@ -259,7 +259,9 @@ void IDisposable.Dispose() // same as display text string ISuggestedAction.IconAutomationText => DisplayText; - ImageMoniker ISuggestedAction.IconMoniker => CodeAction.Glyph?.GetImageMoniker() ?? default(ImageMoniker); + ImageMoniker ISuggestedAction.IconMoniker => CodeAction.Glyph.HasValue + ? ((Glyph)CodeAction.Glyph.Value).GetImageMoniker() + : default(ImageMoniker); string ISuggestedAction.InputGestureText { diff --git a/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs index f491e0c7a361f217cb66c881cd9534c1621b57df..38d5c3ed6bdc823f707395b05fecef3c4d60c581 100644 --- a/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs @@ -391,7 +391,7 @@ private class MyCodeAction : CodeAction.SolutionChangeAction _glyph = glyph; } - internal override Glyph? Glyph => _glyph; + internal override int? Glyph => _glyph.HasValue ? (int)_glyph.Value : (int?)null; } private struct SearchResult where T : ISymbol diff --git a/src/Workspaces/Core/Portable/Shared/Glyph.cs b/src/Features/Core/Portable/Common/Glyph.cs similarity index 100% rename from src/Workspaces/Core/Portable/Shared/Glyph.cs rename to src/Features/Core/Portable/Common/Glyph.cs diff --git a/src/Features/Core/Portable/Features.csproj b/src/Features/Core/Portable/Features.csproj index 62cf652cb8d84b63c0cf266978a7ed68ae244e89..dd7d734a17a2739e31c549c8fddfd35182704160 100644 --- a/src/Features/Core/Portable/Features.csproj +++ b/src/Features/Core/Portable/Features.csproj @@ -147,6 +147,7 @@ + @@ -253,6 +254,7 @@ + diff --git a/src/Features/Core/Portable/Shared/Extensions/ProjectExtensions.cs b/src/Features/Core/Portable/Shared/Extensions/ProjectExtensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..226c26655a7e58dbceecf198c72645569847838d --- /dev/null +++ b/src/Features/Core/Portable/Shared/Extensions/ProjectExtensions.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.Shared.Extensions +{ + internal static class ProjectExtensions + { + public static Glyph GetGlyph(this Project project) + { + // TODO: Get the glyph from the hierarchy + return project.Language == LanguageNames.CSharp ? Glyph.CSharpProject : + project.Language == LanguageNames.VisualBasic ? Glyph.BasicProject : + Glyph.Assembly; + } + } +} diff --git a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs index 67847982cdce5cbfccd943798b0a029c188b1e1d..e75c57522f70523a2e92d4967faf86a06d578e95 100644 --- a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs +++ b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs @@ -47,7 +47,11 @@ public abstract class CodeAction internal virtual bool IsInvokable => true; - internal virtual Glyph? Glyph => null; + /// + /// Will map this int to the Glyph enum in 'Features'. Once a proper image abstration moves + /// to the workspace layer we can appropriately use that here instead of a raw int. + /// + internal virtual int? Glyph => null; internal virtual ImmutableArray GetCodeActions() { diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs index ac09f16fce905c5a625d1a6361218b600b17d681..5680d1645e50fbef4870bbb0361d1d8246c19741 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ProjectExtensions.cs @@ -38,13 +38,5 @@ public static async Task GetVersionAsync(this Project project, Can return version.GetNewerVersion(latestVersion); } - - public static Glyph GetGlyph(this Project project) - { - // TODO: Get the glyph from the hierarchy - return project.Language == LanguageNames.CSharp ? Glyph.CSharpProject : - project.Language == LanguageNames.VisualBasic ? Glyph.BasicProject : - Glyph.Assembly; - } } } \ No newline at end of file diff --git a/src/Workspaces/Core/Portable/Workspaces.csproj b/src/Workspaces/Core/Portable/Workspaces.csproj index 125cb47a9854e9bbce4831e1ee1bbfe36b0fcbef..a44cb8cff38c80eac2342e194b23046c7b244bb0 100644 --- a/src/Workspaces/Core/Portable/Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Workspaces.csproj @@ -385,7 +385,6 @@ -