JetBrains / resharper-fsharp

F# support in JetBrains Rider
Apache License 2.0
327 stars 52 forks source link

Developing ReSharper.FSharp on Linux #107

Open mcon opened 4 years ago

mcon commented 4 years ago

I'm aware this isn't explicitly supported at the moment as per the README, but thought I'd have a quick go to see how far off this is from being possible.

Is anyone familiar with how far away this support is, what the downstream dependencies are, and whether any help would be appreciated.

auduchinok commented 4 years ago

I haven't tried building/running it on Linux but speaking from my experience it's possible to bulid the plugin, run, and debug it loaded to a sandboxed Rider on macOS which should be a similar experience.

There's no need to change the target frameworks due to use of the reference assemblies package: https://github.com/JetBrains/fsharp-support/blob/dbee3578ab7ab1170f55481b5169fcfc1b27b325/ReSharper.FSharp/Directory.Build.props#L19

The only stopper is it's not possible to run/debug ReSharper tests which is quite a blocker when you are working on the code. I was promised we'll be able to run tests (hopefully) soon but there are no estimates for now. Migrating to .NET Core can greatly improve things here since many related things are being updated and/or rewritten in the platform.

There is a recent workaround for running tests in the Unity plugin: https://github.com/JetBrains/resharper-unity/pull/1560. It didn't work for me on the first try and I'm going to look into it again later since I'd be happy not to be forced to use Windows for development most of the time too.

Attaching to a Mono runtime sometimes works worse than attaching to a .NET Framework process in terms of debugging features working nicely (some things sometimes cannot be evaluated, some code may be skipped, especially when trying to debug ReSharper SDK code) and it's likely moving to .NET Core will also significantly improve things here since a more stable debugger would be used.

I hope this helps. If there's something that doesn't work for you, please let me know so we could try to fix/improve it. I guess it's high time I updated the readme to reflect the current state. :)

TL;DR Everything except running ReSharper tests should work mostly fine on Linux.

auduchinok commented 4 years ago

There was a bug in 2019.3.x releases that would make Rider choose an MSBuild from Mono instead of the Core one on this solution and it wouldn't work well. If you're using that release please choose an MSBuild from .NET Core SDK in Preferences | Build, Execution, Deployment | Toolset and Build manually.

mcon commented 4 years ago

Thanks for getting back to me, so I can get a build working using MSBuild from netcore 3.1.102, but as you suggest I can't run the tests due to (not unsurprising) library load errors.

I did have to make a trivial change to a project file to get the build working however: https://github.com/JetBrains/fsharp-support/pull/108

I was hoping to be able to develop a new code completion feature, but as you say: it's a non-starter without being able to run the tests! Sounds like I should be waiting for you guys to get onto netcore, or digging out an old machine to run Windows on!

Sejsel commented 3 years ago

I tested this now, found one generated file that wasn't placed in the correct location (made a PR, #165). Tests are still not supported, but other than that everything seems to work.