Skip to content
| Marketplace
Sign in
Visual Studio>Tools>CSharpAIStudio
CSharpAIStudio

CSharpAIStudio

MenTian

|
389 installs
| (0) | Free
A set of GPT based code tools, including commenting, reviewing, and improving your C# code
Download

What plugins can provide

Comment the code (Text editor context menu , CodeLens , ToolBar--Batch Comment )

You can comment on code snippets, as well as classes, methods.

If you comment from CodeLens, the comment will have a rich visual experience

image__5.png

You can perform comment for multiple nodes from CodeLens at the same time
comment will be inserted sequentially (By AI response order) into the file, even if you close the file (not recommended) and switch files.

Explain the code (Text editor context menu , CodeLens)

When you get the code you are not familiar with, you can use this method to quickly understand the code, and the AI will explain the function and principle of the code for you.

Screenshots

CodeLens

CodelLens will display the last AI reply in the code explanation chat between you and the AI

image__6.png

VS Window

image__8.png

Improve the code (Text editor context menu , CodeLens)

This feature can quickly optimize your code, resolve bugs, and find bugs. and generate the correct code.

You can click the 'Apply' button in the window to quickly replace the AI-generated code.

Note that carefully discern the code generated by the AI, as it may be wrong.

Screenshots

VS Window

image__7.png

Code completion (Text editor context menu)

You can write the code requirements you want to write in natural language in the IDE, and select your requirements. Select the code, right-click and select Complete(CSharpAIStudio), click ask, and wait for a response. The generated code is inserted into your mouse position. You can use the attributes, types, and methods in your current solution in your requirements. to improve code quality.

Save your chat with the AI to the solution (can be managed under version control)

Save the conversation file to Json so that the whole team can reuse the conversation as much as possible and avoid repetitive token

Use your custom prompt (Only Azure OpenAI)

   The extension will export the default prompt to **Environment.SpecialFolder.MyDocuments\CSharpAIStudio\Prompt** 
   You can make any changes to the prompt and change 'Use custom prompt' in the options

   **These prompts use the handlebars template.** 

Use your custom model (Starting with Ver1.0.0.30)

    You can write a request plugin for customization in C#.
    Add CSharpAIStudio.ModelService.dll to your project, which is in the extension installation directory.
    Inherit from IModelServiceClient and implement whatever you want.
    Also open 'Custom requests' in the options and fill in the name of your assembly in 'StorageName' eg. 'CSharpAIStudio.ModelService.Client.Phi3==namespace.classname'
    (You can change both of these settings at any time, and they will take effect at the next request)

    **The dll of your custom model needs to be placed in 'Environment.SpecialFolder.MyDocuments\\CSharpAIStudio\'**

Get started

1 Fill in your Azure OpenAI information

 Tools-->Options-->CSharpAIStudio-->Azure OpenAI

2 Decide whether to save the conversation to the solution

 Tools-->Options-->CSharpAIStudio-->Behavior-->Chat Save-->Save Chat to Project

3 Decide whether to display codelens

 Tools-->Options-->Text Editor-->All Languages-->CodeLens-->Show CSharpAIStudio
 
  This will give you additional options to do quickly on your classes, methods. and jump-start conversations.

4 Open the solution and when the CodeLens is displayed, you can get started

image__2.png

Options

You can see the specific descriptions of each option in VS, and I'm going to explain two of them separately here

RelatedCodes (Explain,Improve,Complete,Comment)

Explain,Improve,Comment

    This will look for 'references' in the solution and use them. (as with 'references'' in codelens).

###Complete

   This will look for the class, method you mentioned in the solution.

Extend RelatedCodes (Explain,Improve,Comment)

Unlike 'references', this will look up other classes, methods, properties, and fields in your code in the solution.

Example

You have a class definition
public class Option
{......}
You have a wpf window definition
public partial class WindowControl : Window
{  
     this.InitializeComponent();  
     var a = new Option();
}
Extend RelatedCodes will found class name 'Option' ,And use it in chat.
If your code is very complex, it will consume a lot of tokens

#CodeLens ##The extension contains three CodLens indicators.

###Charpais Studio

this CodeLens will have four different icons to indicate the current code node state:

 none (no explanation/improvement chat exists on the current node)
 Explain (Only explain  chat exists)
 Improve(Only Improve chat exists)
 OK(Both  Explain ,Improve chat exists)

###C# Extend Related Code

Unlike the 'references' of VS, the references show who called you, 'C# Extend Related Code' shows who you called

image__12.png

 **This was added in 1.0.1.2** 

###C# Extend Related Code(new)

It's a whole new view of 'C# Extend Related Code'

Because of the differences in the way you look up, the data shown is not exactly the same. It also supports jumping files, which you can double-click on the data to jump.

image__3.png

 **This was added in 1.0.1.3** 

You can decide whether to turn on these codelenses or not in the options

     Tools-->Options-->Text Editor-->All Languages-->CodeLens-->Show CSharpAIStudio
     Tools-->Options-->Text Editor-->All Languages-->CodeLens-->Show C# Extend Related Code
     Tools-->Options-->Text Editor-->All Languages-->CodeLens-->Show C# Extend Related Code(new)

#Text editor context menu

image__9.png

In a text editor (C# code only), you can select a subset of text to execute these commands. But there are a few caveats.

When you choose code that happens to be the full code of a method or class, it's the equivalent of starting from CodeLens.

#Solution context menu

image__10.png

You can use both buttons separately to clear/overload the conversation history. In most cases, it shouldn't be needed.

Note

unless you start a new conversation after clearing (codelens, solution), any chat history will not be lost when you reopen the solution or reload.

Important

Explain, Improve will default to using the current code as the dialogue, and different codes will have different dialogues, which is expected and not a bug

This plugin uses Azure OpenAI by default

Privacy

This extension doesn't have any other collection activity, other than the Azure OpenAI SDK.

Other

If you have any comments or suggestions, please leave a message in the Q&A. I really hope this extension can help you better.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft