diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000000..f080750a6d8d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + /* + Recommended VS Code extensions for the LEAN engine + */ + "recommendations": [ + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "ms-vscode-remote.remote-containers", + "ms-python.python" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 728a24b827d9..bfd639242446 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,24 +2,22 @@ /* VS Code Launch configurations for the LEAN engine - Launch: - Builds the project with dotnet 6 and then launches the program using coreclr; supports debugging. - In order to use this you need dotnet 6 on your system path, As well as the C# extension from the - marketplace. + Launch LEAN: + Builds the project and then launches the program using coreclr; supports debugging. + Requires the C# extension from the marketplace. + + Run Tests: + Builds and runs tests with an optional filter prompt. Attach to Python: Will attempt to attach to LEAN running locally using DebugPy. Requires that the process is actively running and config is set: "debugging": true, "debugging-method": "DebugPy", - Requires Python extension from the marketplace. Currently only works with algorithms in - Algorithm.Python directory. This is because we map that directory to our build directory - that contains the py file at runtime. If using another location change "localRoot" value - to the directory in use. + Requires Python extension from the marketplace. */ - "version": "0.2.0", "configurations": [ { - "name": "Launch", + "name": "Launch LEAN", "type": "coreclr", "request": "launch", "preLaunchTask": "build", @@ -33,15 +31,34 @@ "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" }, + { + "name": "Run Tests", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "dotnet", + "args": [ + "test", + "${workspaceFolder}/Tests/QuantConnect.Tests.csproj", + "--no-build", + "--filter", + "TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests" + ], + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, { "name": "Attach to Python", "type": "python", "request": "attach", "port": 5678, - "pathMappings":[{ - "localRoot": "${workspaceFolder}", - "remoteRoot": "${workspaceFolder}" - }] + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "${workspaceFolder}" + } + ] } ] } \ No newline at end of file diff --git a/.vscode/readme.md b/.vscode/readme.md index 69889e52cb93..6a31382e4e90 100644 --- a/.vscode/readme.md +++ b/.vscode/readme.md @@ -51,13 +51,15 @@ If you would like to mount any additional local files to your container, checkou

Option 3: Install Dependencies Locally

-1. Install [.NET 9](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) for the project +1. Install [.NET 10](https://dotnet.microsoft.com/en-us/download/dotnet/10.0) for the project -2. (Optional) Get [Python 3.11.11](https://www.python.org/downloads/release/python-31111/) for running Python algorithms +2. (Optional) Get [Python 3.11.14](https://www.python.org/downloads/release/python-31114/) for running Python algorithms - Follow Python instructions [here](https://github.com/QuantConnect/Lean/tree/master/Algorithm.Python#installing-python-311) for your platform 3. Get [Visual Studio Code](https://code.visualstudio.com/download) - Get the Extension [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) for C# Debugging + - Get the Extension [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) for the .NET Test Explorer and enhanced C# development + - Get the Extension [IntelliCode for C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.vscodeintellicode-csharp) for AI-assisted IntelliSense - Get the Extension [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) for Python Debugging 4. Get Lean into VS Code @@ -107,6 +109,9 @@ In VS Code run build task (Ctrl+Shift+B or "Terminal" dropdown); there are a few - __Build__ - basic build task, just builds Lean once - __Rebuild__ - rebuild task, completely rebuilds the project. Use if having issues with debugging symbols being loaded for your algorithms. - __Clean__ - deletes out all project build files +- __Test__ - runs the unit tests (requires building first) + +**Note:** VS Code will prompt you to install the recommended extensions (C#, C# Dev Kit, Python) when you first open the workspace. You can also install them manually or via the `extensions.json` file.
diff --git a/.vscode/settings.json b/.vscode/settings.json index a6eaab3c589f..8ec4fcfcf05d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,28 @@ { "files.eol": "\n", + "files.exclude": { + "**/bin": true, + "**/obj": true, + "**/.git": true + }, + "search.exclude": { + "**/bin": true, + "**/obj": true + }, + "omnisharp.enableRoslynAnalyzers": true, + "omnisharp.enableEditorConfigSupport": true, + "dotnet.defaultSolution": "QuantConnect.Lean.sln", + "editor.formatOnSave": true, + "editor.rulers": [ + 150 + ], + "[csharp]": { + "editor.defaultFormatter": "ms-dotnettools.csharp", + "editor.tabSize": 4, + "editor.insertSpaces": true + }, "python.analysis.extraPaths": [ - "/Lean/Algorithm.Python", - "/opt/miniconda3/lib/python3.8/site-packages" + "./Algorithm.Python", + "/opt/miniconda3/lib/python3.11/site-packages", ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0f6a171a1c05..3feae4e87dba 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,7 +1,7 @@ { /* VS Code Tasks for the LEAN engine - In order to use the build tasks you need msbuild on your system path. + In order to use the build tasks you need dotnet on your system path. */ "version": "2.0.0", "tasks": [ @@ -11,11 +11,15 @@ "command": "dotnet", "args": [ "build", + "${workspaceFolder}/QuantConnect.Lean.sln", "/p:Configuration=Debug", "/p:DebugType=portable", "/p:WarningLevel=1" ], - "group": "build", + "group": { + "kind": "build", + "isDefault": true + }, "presentation": { "reveal": "silent" }, @@ -27,6 +31,7 @@ "command": "dotnet", "args": [ "build", + "${workspaceFolder}/QuantConnect.Lean.sln", "--no-incremental", "/p:Configuration=Debug", "/p:DebugType=portable", @@ -44,6 +49,7 @@ "command": "dotnet", "args": [ "clean", + "${workspaceFolder}/QuantConnect.Lean.sln" ], "group": "build", "presentation": { @@ -51,17 +57,35 @@ }, "problemMatcher": "$msCompile" }, + { + "label": "test", + "type": "shell", + "command": "dotnet", + "args": [ + "test", + "${workspaceFolder}/Tests/QuantConnect.Tests.csproj", + "--no-build" + ], + "group": { + "kind": "test", + "isDefault": true + }, + "presentation": { + "reveal": "always" + }, + "problemMatcher": "$msCompile" + }, { "label": "start research", "type": "shell", "dependsOn": ["build"], "group": "build", "isBackground": true, - "command" : "${workspaceFolder}/.vscode/launch_research.sh", - "args" : [ + "command": "${workspaceFolder}/.vscode/launch_research.sh", + "args": [ "${workspaceFolder}/Launcher/bin/Debug" ], "problemMatcher": "$msCompile" } ] -} \ No newline at end of file +}