---
# System prepended metadata

title: '`VSIX` による、電球アイコンによる提案（サジェストアクション）の表示 2022-01-26'
tags: [VSIX, ISuggestedActionsSource, ISuggestedAction, ISuggestedActionsSourceProvider]

---

---
lang: ja-jp
breaks: true
---
# `VSIX` による、電球アイコンによる提案（サジェストアクション）の表示 2022-01-26

> https://docs.microsoft.com/ja-jp/visualstudio/extensibility/walkthrough-displaying-light-bulb-suggestions?view=vs-2022

![](https://i.imgur.com/UqGgry9.png)

## 一旦 `Editor Classifier` テンプレートを追加後、出来上がったソースを削除すると簡単

![](https://i.imgur.com/bGjbXka.png)

```csharp=
    [Export(typeof(ISuggestedActionsSourceProvider))]
    [Name("Test Suggested Actions")]
    [ContentType("text")]
    internal class SuggestedActionsSourceProvider : ISuggestedActionsSourceProvider
    {
        [Import(typeof(ITextStructureNavigatorSelectorService))]
        internal ITextStructureNavigatorSelectorService NavigatorService { get; set; }

        [Import]
        internal IEditorOperationsFactoryService EditorOperations = null;

        public ISuggestedActionsSource CreateSuggestedActionsSource(
            ITextView textView,
            ITextBuffer textBuffer
            )
        {
            if (textBuffer == null && textView == null)
            {
                return null;
            }

            return new SuggestedActionsSource(
                this,
                textView,
                textBuffer
                );
        }
    }

```

###### tags: `VSIX` `ISuggestedActionsSourceProvider` `ISuggestedActionsSource` `ISuggestedAction`
