Although Agent Mode has been available in Visual Studio Code for a couple of weeks, as of May 14 it is available in the much-preferred VS 2022 v17.14.0 for debugging, performance profiling, etc.
I’ve found it quite useful when utilizing the Gemini 2.5 Pro LLM, but it’s not for the programming faint of heart nor is it supported by NinjaTrader. It can automate a lot of programming tasks, but you will always want to understand what is being done every step of the way.
Using .copilot-instructions.md market file is useful for repetitive instructions you want Copilot to be reminded of with each prompt. Here are some for example:
- Target: .NET Framework 4.8, C# 9.0, NinjaTrader 8 NinjaScript.
- Exclusions: Exclude any code that is automatically generated by NinjaTrader. This includes, but is not limited to, code within the
#region NinjaScript generated code
section. - Parameter Properties: Order:
Name, Description, GroupName, Order
. Place below methods. - Plot Properties: Place below methods.
I am finding on larger scripts, Agent Mode does not always wait for the NinjaScript to compile before moving on to the next task. Prompts can be structured so you do the save action to trigger the NT compiler before continuing with the agent’s recommended actions. It also helps if you keep your source code library a modest size, so the NT compile take less time.
Occasionally, Copilot will not respond after a while and will generate errors in the Copilot output messages. I have found these can be resolved by logging out and back into your GitHub account.
How are you using Visual Studio 2022 v17.14.0 and the new Agent Mode for coding?