FsAutoComplete icon indicating copy to clipboard operation
FsAutoComplete copied to clipboard

use the version of Fantomas specified in .config/dotnet-tools.json

Open witoldsz opened this issue 3 years ago • 2 comments

I use Ionide-VSCode and it uses FsAutoComplete and… it uses whatever Fantomas version it was set in it's last release. On the other hand, there are building scripts and they use dotnet fantomas specified in .config/dotnet-tools.json.

It is really inconvenient, because every now and then, the Ionide plugin gets updated and so the Fantomas gets updated:

  • one day my code gets formatted this way, next day it re-formats unexpectedly and then the building scripts fail the release because the dotnet fantomas --check fails
  • as of now, the most recent Fantomas version in FsAutoComplete has a bug, so I cannot just upgrade my .config

Would it be possible to make FsAutoComplete use the same version of Fantomas the .config actually declares? That would solve all the issues above.

witoldsz avatar Jan 09 '21 23:01 witoldsz

This would be difficult without some sort of in-process isolation. I know we do this for analyzers, I suppose such a thing could be done for Fantomas as well.

baronfel avatar Jan 11 '21 20:01 baronfel

As a bit of an update to this issue, Fantomas has been working on an out-of-process LSP-based daemonized implementation which would be distributed as a dotnet tool, to more easily integrate into all editors. We have yet to try and test/integrate this version here, but the basic flow would be:

  • FSAC would bundle a particular version of the dotnet tool as part of its packaging
  • FSAC at runtime would attempt to launch a dotnet tool configured in your repository's global.json as a dotnet tool
    • if no such tool is found, FSAC would use its bundled version
  • When a document formatting request is received, we'd essentially proxy that request to the launched fantomas LSP server and stream the response back to the calling client

baronfel avatar May 08 '21 16:05 baronfel