Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

Quick Actions

  • 2025-06-12
Feedback

In this article

Quick Actions in Visual Studio let you easily refactor, generate, or otherwise modify your code with a single action. Quick Actions are available for C#,C++, and Visual Basic code files. Some actions are specific to a language, and others apply to all languages.

Quick Actions can be used to:

Understand Quick Action icons

Visual Studio uses several icons to indicate when Quick Actions are available. The icon type indicates whether the Quick Action is a recommendation or required fix, including refactoring:

  • Screwdriverscrewdriver icon: Suggested action to improve your code.

  • Yellow light bulblight bulb icon: Recommended action to address noncritical issues with your code.

  • Error light bulberror light bulb icon: Critical action to fix an error in your code, or apply necessary refactoring.

For any language, third parties can provide custom diagnostics and suggestions, such as part of an SDK. Visual Studio shows light bulbs based on those rules.

Find available actions

You can check your code for available Quick Actions in Visual Studio by scanning for the light bulblight bulb icon, screwdriverscrewdriver icon, and error light bulberror light bulb icon:

  • Move your mouse over your code and notice any Quick Action icons:

    Screenshot that shows the basic Quick Action recommendation and light bulb icon in Visual Studio.

  • Move the insertion cursor (|) into a line of code, and check for Quick Action icons in the left margin of the code editor.

You can also manually check for any available Quick Actions:

  • Right-click a line of code and chooseQuick Actions and Refactorings for a list of available Quick Actions and refactoring options.

  • Select Ctrl + period (.) anywhere on a line.

Apply recommendations to improve code

When Quick Actions are available, you can select the light bulblight bulb icon or screwdriverscrewdriver icon icon next to the applicable code.

  • To see the available improvements, select the Down arrow next to the icon or use theShow potential fixes link.

    Screenshot that shows the Quick Action recommendation details with the light bulb icon in Visual Studio.

  • To apply the recommended change to your code, select the icon. You can also select Ctrl + period (.) when your cursor is on a line of code that shows an available action.

Apply actions to fix errors

If there's an error in your code, and Visual Studio has a recommended fix, you see a red squiggle under the code with the error. The error light bulberror light bulb icon icon also displays next to the marked code.

  • To see the available fixes, select the Down arrow next to the icon or use theShow potential fixes link.

    Screenshot that shows the Quick Action potential fix and error light bulb icon in Visual Studio.

  • To apply the recommended change to your code, select the icon. You can also select Ctrl + period (.) when your cursor is on a line of code that shows an available action.

Tip

You can turn off some of the code fix Quick Actions. For more information, seeDisable source code analysis for .NET.

Get AI assistance

If you haveCopilot, you can get AI assistance while using the Quick Actions light bulb. From the light bulb menu, chooseFix with Copilot. This opens an inline chat with GitHub Copilot Chat, offering you an available fix.

Screenshot that shows the Quick Action GitHub Copilot option for the light bulb.

Related content


Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo