Godot-Mono: Difference between revisions

Initial migration of article from Godot to Godot-Mono.
 
Configuring VSCode Editor for Godot-Mono (C#): Current working solution for Godot C#
Line 14: Line 14:
As Godot editor has poor support for C#, VSCode editor is recommended.
As Godot editor has poor support for C#, VSCode editor is recommended.


Install and configure VSCode as such:
You can install and configure VSCode as such:
  programs.vscode = {
  programs.vscode = {
   enable = true;
   enable = true;
   package = pkgs.codium;
  # `pkgs.vscodium` is unsupported by "C# Dev Kit" VSCode extension which demands [https://marketplace.visualstudio.com/items/ms-dotnettools.csdevkit/license Microsoft license] compliance.
   package = pkgs.vscode;
   profiles.default = {
   profiles.default = {
     "godotTools.lsp.serverPort" = 6005; # port should match your Godot configuration
     "csharp.toolsDotnetPath" = "${pkgs.dotnet-sdk_9}/bin/dotnet";
     "dotnetAcquisitionExtension.sharedExistingDotnetPath" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
     "dotnetAcquisitionExtension.sharedExistingDotnetPath" = "${pkgs.dotnet-sdk_9}/bin/dotnet";
     "dotnetAcquisitionExtension.existingDotnetPath" = [
     "dotnetAcquisitionExtension.existingDotnetPath" = [
        {
      {
           "extensionId" = "ms-dotnettools.csharp";
          "extensionId" = "ms-dotnettools.csharp";
            "path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
          "path" = "${pkgs.dotnet-sdk_9}/bin/dotnet";
         }
        }
         {
        {
            "extensionId" = "ms-dotnettools.csdevkit";
         "extensionId" = "ms-dotnettools.csdevkit";
            "path" = "${pkgs.dotnet-sdk_8}/bin/dotnet";
          "path" = "${pkgs.dotnet-sdk_9}/bin/dotnet";
         }
        }
      {
        "extensionId" = "woberg.godot-dotnet-tools";
        "path" = "${pkgs.dotnet-sdk_8}/bin/dotnet"; # Godot-Mono uses DotNet8 version.
      }
      ];
      ];
    "godotTools.lsp.serverPort" = 6005; # port should match your Godot configuration
    "omnisharp" = { # OminiSharp is a custom [[wikipedia:Language_Server_Protocol|LSP]] for C#
      "path" = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
      "sdkPath" = "${pkgs.dotnet-sdk_9}";
      "dotnetPath" = "${pkgs.dotnet-sdk_9}/bin/dotnet";
    };
   extensions = with pkgs.vscode-extensions; [
   extensions = with pkgs.vscode-extensions; [
     geequlim.godot-tools # For Godot GDScript
     geequlim.godot-tools # For Godot GDScript support
    woberg.godot-dotnet-tools # For Godot C# support
     ms-dotnettools.csdevkit
     ms-dotnettools.csdevkit
     ms-dotnettools.csharp
     ms-dotnettools.csharp
Line 38: Line 50:
   ];
   ];
  };
  };
home.packages = [
  dotnetCorePackages.dotnet_9.sdk # For Godot-Mono VSCode-Extension CSharp
];
# The proposed solution above requires .Net SDK to be broadly available in the host.
# Code is ugly but works. Ideally we should find a better solution to this.
# If you wonder why solution got so complex, test VSCode extensions as immutable,
# using flag "programs.vscode.mutableExtensionsDir = false". (No external downloads.)
Configure Godot's '''Editor → Editor Settings''' menu:
Configure Godot's '''Editor → Editor Settings''' menu: