dotrush

repository·main·Indexed 20 days ago

https://github.com/janeysprings/dotrush

A lightweight C# development environment for Visual Studio Code, NeoVim, Zed, and Sublime Text. It provides Roslyn-based IntelliSense, .NET Core debugging and profiling, and specialized debugging support for Unity and Godot projects. Features include an integrated Test Explorer for NUnit, xUnit, and MSTest, multi-target diagnostics, and code decompilation via ICSharpCode Decompiler.

Tokens
7.2K
Snippets
22
Records
29
Agent score
72%

What's inside dotrush

  1. DotRush language support and limitations

    main

    DotRush is optimized for C# development.

    Supported Features:

    • Roslyn-based IntelliSense (autocompletion, suggestions, navigation).
    • .NET Core Debugging and Profiling.
    • Unity and Godot debugging.
    • Multi-target diagnostics (linting/error detection across target frameworks).
    • Code decompilation via ICSharpCode Decompiler.

    Unsupported Features/Languages:

    • Languages: Does not support Razor, XAML, or other non-C# languages.
    • CodeLens: Does not support CodeLens features such as showing references or test context within the source code.
  2. Profile .NET Core applications

    main

    DotRush includes built-in support for dotnet-trace and dotnet-gcdump to profile your applications.

    Using Commands

    You can attach the profiler to a running process using these commands:

    • DotRush: Attach Trace Profiler
    • DotRush: Create Heap Dump

    Using the Debugger Toolbar

    If the .NET Core Debugger is currently running, you can use the profiling buttons directly in the debugger toolbar.

    Viewing Reports

  3. Select projects and solutions in DotRush

    main

    If your workspace contains multiple projects or a solution file, DotRush will prompt you with a picker to select the relevant files. DotRush automatically saves your selection in the workspace settings. To manually trigger this selection process, use the command:

    DotRush: Pick Project or Solution files

  4. Set up DotRush with Sublime Text

    main

    To use DotRush in Sublime Text:

    1. Install the LSP plugin via Package Control.
    2. Download the latest DotRush.Server from GitHub Releases.
    3. Open LSP settings (Preferences -> Package Settings -> LSP -> Settings) and add the following configuration, replacing Your\Path\To\DotRush.exe with your actual path:
    {
    	"clients": {
            "dotrush": {
                "enabled": true,
                "command": ["Your\\Path\\To\\DotRush.exe"],
                "selector": "source.cs",
            }
        }
    }
  5. Debug Unity projects

    main

    To debug Unity projects, use the integrated Mono Debugger.

    1. Open your Unity project in VS Code (e.g., by opening it directly from the Unity Editor).
    2. Press F5 and select the Unity Debugger configuration.

    Alternatively, you can configure a launch.json file for attaching to the Unity process.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Unity Debugger",
                "type": "unity",
                // Attach to Android device
                // "transportArgs": {
                //     "type": "android"
                // },
                "request": "attach"
            }
        ]
    }
  6. Set up DotRush with Zed

    main

    To use DotRush in Zed:

    1. Install Rust via rustup.
    2. Download the Zed folder from the repository and place it on your computer.
    3. In Zed, go to the Extensions tab and click Install Dev Extension.
    4. Select the downloaded Zed folder and restart Zed.

    Troubleshooting: failed to spawn command error If you encounter this error, you must grant execution permissions to the language server manually:

    macOS:

    chmod +x "/Users/You/Library/Application Support/Zed/extensions/work/dotrush/LanguageServer/dotrush"

    Linux:

    chmod +x "/home/You/.local/share/zed/extensions/work/dotrush/LanguageServer/dotrush"
  7. Set up DotRush with Neovim

    main

    To use DotRush in Neovim, you must use nvim-lspconfig and provide the path to the DotRush.Server executable.

    1. Install a plugin manager like vim-plug.
    2. Download the DotRush.Server executable from the latest GitHub release.
    3. Add the following configuration to your init.vim (adjusting the cmd path to your actual executable location):
    call plug#begin()
    Plug 'https://github.com/neovim/nvim-lspconfig'
    call plug#end()
    
    lua << EOF
    require('lspconfig.configs').dotrush = {
        default_config = {
            cmd = { '/Path/To/Executale/dotrush' }, -- Adjust path to the DotRush executable
            filetypes = { 'cs', 'xaml' },
            root_dir = function(fname)
                return vim.fn.getcwd()
            end
        };
    }
    require('lspconfig').dotrush.setup({})
    EOF
  8. Debug Godot projects

    main

    To debug a Godot project, you must create a launch.json file and specify the path to your Godot Engine executable in the processPath field.

    1. Create .vscode/launch.json with the configuration below.
    2. Adjust processPath to your local Godot installation.
    3. Press F5 to launch the Godot Engine and attach the debugger.
    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": ".NET Core Debugger (attach)",
                "type": "coreclr",
                "request": "attach",
                "processPath": "C:\\Programs\\Godot\\Godot_v4.4.1-stable_mono_win64.exe",
                "preLaunchTask": "dotrush: Build"
            }
        ]
    }
  9. Run and debug NUnit, xUnit, or MSTest tests

    main

    DotRush provides an integrated Test Explorer for running and debugging VSTest compatible tests (NUnit, xUnit, MSTest).

    • To Run: Click the run button located next to the test in the Test Explorer.
    • To Debug: Right-click the run button next to the test and select Debug Test from the context menu.
  10. Run and debug .NET Core applications

    main

    You can debug .NET Core applications using the built-in .NET Core Debugger.

    1. Quick Start: Press F5 and select the .NET Core Debugger configuration.
    2. Custom Configuration: Create a .vscode/launch.json file to define launch or attach behaviors.
    3. Startup Project: To change which project is treated as the startup project, right-click the project in the explorer and select Set as Startup Project from the context menu.

    Debugger options can be further customized in the VS Code settings.

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": ".NET Core Debugger (launch)",
                "type": "coreclr",
                "request": "launch",
                "program": "${command:dotrush.activeTargetPath",
                "preLaunchTask": "dotrush: Build"
            },
            {
                "name": ".NET Core Debugger (attach)",
                "type": "coreclr",
                "request": "attach",
                "processId": "${command:dotrush.pickProcess}"
            }
        ]
    }
  11. How DotRush resolves launch settings and profiles

    main

    DotRush automatically looks for .NET launchSettings.json files to manage debug profiles.

    1. Locating Settings: It searches for launchSettings.json within a Properties folder located in the same directory as your active project.
    2. Profile Selection Logic: When retrieving a profile via getLaunchProfile:
      • If a specific profileName is provided, it returns that profile.
      • If no name is provided and the project is a web project, it defaults to the https profile.
      • Otherwise, it defaults to the first available profile in the profiles object.
  12. Configure DotRush via dotrush.config.json

    main

    You can configure DotRush by creating a dotrush.config.json file in your project root directory or next to the server executable.

    If the server fails to detect a project automatically, you must provide the projectOrSolutionFiles option under the dotrush.roslyn namespace. All available configuration options are located in the DotRush extension's package.json file.

    {
        "dotrush": {
            "roslyn": {
                "projectOrSolutionFiles": [
                    "/path/to/your/solution.sln"
                ]
            }
        }
    }