Facepunch / sbox-issues

173 stars 11 forks source link

Rider is not detected #5205

Open verdie-g opened 5 months ago

verdie-g commented 5 months ago

Describe the bug

I'm using Rider but s&box doesn't seem to detect it because it's greyed out in the selection. image

Though, if Rider is already running, s&box is able to detect it and I can select it image

A little more annoying thing is that whenever I restart the editor, my editor preference is lost so opening the solution runs VS.

One thing that could be different than a usual setup is that I installed Rider through JetBrains toolbox.

To Reproduce

  1. Install Rider through JetBrains toolbox
  2. Run the s&box editor
  3. Try to select Rider in the editor settings, it should be greyed out
  4. Run Rider in the background
  5. Open the editor settings again and Rider should now be available

Expected behavior

Rider should correctly be detected by s&box.

Media/Files

No response

Additional context

No response

handsomematt commented 5 months ago

This stuff was fine but Jetbrains change and make it more complicated every new version Rider, they have their own NuGet package for it https://www.nuget.org/packages/JetBrains.Rider.PathLocator/

I don't really want us to have to use that...

verdie-g commented 5 months ago

Personally, I find it okay if s&box requires Rider to be running to be detected as long as it mentions it in the editor settings dialog. But currently after restarting the IDE it's reset to VS. Fixing that part could be a good first step.

nick-strohm commented 1 month ago

I changed the detection code for Rider from

if ( value == null )
{
    // try again for a toolbox install
    using ( var key = Registry.ClassesRoot.OpenSubKey( @"Applications\\Toolbox.Rider.ch-0\\shell\\open\\command" ) )
    {
        value = key?.GetValue( "" ) as string;
    }
}

to

if ( value == null )
{
    // try again for a toolbox install
    var subKeyRegex = new Regex( @"^Toolbox\.Rider\.[a-z0-9\-]+$", RegexOptions.IgnoreCase );

    var applicationsKey = Registry.ClassesRoot.OpenSubKey( "Applications" );

    foreach ( var subKeyName in applicationsKey.GetSubKeyNames() )
    {
        if ( subKeyRegex.IsMatch( subKeyName ) )
        {
            using ( var key = applicationsKey.OpenSubKey( $"{subKeyName}\\shell\\open\\command" ) )
            {
                value = key?.GetValue( "" ) as string;
                break;
            }
        }
    }
}

It is backwards compatible with the existing solution and also supports the new structure which ends with a guid.