-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting doesn't work with WSL2 hosted files in VS2022 #29
Comments
Hey @Nekroido,
If there's a dotnet tool version defined in |
It will work if there's no tool manifest defined - with the globally installed formatter. |
Hi! Sorry, looks like I never pressed the "Comment" button.
|
Hello, Code '11' means that Fantomas daemon (your global or local tool) could not be started. open System
open System.IO
let userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
Path.Combine(userProfile, ".dotnet", "tools", "fantomas.exe") in a F# interactive session ( |
The path exists in the Windows host. It also exists in my Debian host but without the |
Alright, can you execute the |
Both executables exit with |
Ah apologies, you need to add the |
Both executables wait for the input and crash with the following trace when I press Enter:
|
Yeah, that sounds about right. Could you create a script file with: #r "nuget: Fantomas.Client"
open System.IO
open Fantomas.Client.Contracts
open Fantomas.Client.LSPFantomasService
let service = new LSPFantomasService() :> FantomasService
// TODO: change file path to existing file on your machine
let file = @"C:\Users\nojaf\Projects\HelloWorld\Math.fs"
let content = File.ReadAllText file
let response =
service.FormatDocumentAsync { SourceCode = content; FilePath = file; Config = None }
|> Async.AwaitTask
|> Async.RunSynchronously
printfn "%A" response What does that output? |
It outputs a formatted document in Windows environment when I provide a valid absolute I see the error you mentioned initially if I use |
Yeah, the behaviour we see is starting to make some sense. |
Just chiming in as I'm running into the exact same issue. Nothing happens when I try to execute
Running the commands above work just like @Nekroido mentions. |
@nojaf Is there a way to get more detailed output, or to set it up for debugging? I should probably add that we use the |
Hi, I don't think
If you can step into the Fantomas.Client source, I expect |
Btw, this is not WSL2. However, I just found out that the formatting does work correctly on an older .NET Framework project, using VS 2022. @nojaf, thanks, I'll give it a go. |
I've published a new version for VS22 that has much better error logging for this case. |
I'll try, let me update. |
@deviousasti, silly question, but I only installed this so far through Marketplace. Do you know what to update? I assume I run the |
I've released 1.1.0 on the marketplace.
You should be able to go Extensions > Manage Extensions > Update and
install the new version.
…On Fri, 6 May 2022, 5:41 pm Abel Braaksma, ***@***.***> wrote:
@deviousasti <https://github.com/deviousasti>, silly question, but I only
installed this so far through Marketplace. Do you know what to update? I
assume I run the build.ps1 script, but then what, just replace some dll
somewhere, I guess?
—
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASD6PTBDAS56RSQCJKGFKDVIUD5PANCNFSM5T76M2PQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I just did a local compile of the sln file, found the |
Oh, yes, that'd work too! 😄 |
Sir, you are flexing your build skills. 😄
…On Fri, 6 May 2022, 5:56 pm Abel Braaksma, ***@***.***> wrote:
Oh, yes, that'd work too! 😄
—
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASD6PXF2D3GTX2GDLQLORLVIUFW3ANCNFSM5T76M2PQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@deviousasti, this is the new output from the tool:
|
That's an interesting error, as I installed the tool globally with the The improved error reporting is very useful, thanks! However, good news is that after doing a I don't know if this would also solve it for |
Yes, this is the current behavior. |
Yup, it's much clearer where the issue lies now. I can confirm the "file came from another computer" error. I guess I'm out of luck and I need to consider setting up my dev env in Windows host. Unless it's possible to skip loading |
The flow is the following: So, if you have a global tool in both places that might work but I suspect you will bump into problems when detecting the |
On WSL2, if there's no local config, I can confirm that the file formats with the global tool. |
I have a fresh machine and installed the extension into Visual Studio, getting the same error @abelbraaksma 👍 Tried many things, those are the steps that need to be done in addition to installing this VS extension:
Reopening of Visual Studio is sometimes needed. Also
The options pane is not shown, but that is already mentioned in well handled in #28 |
I too am running into this. Is there a way to configure Fantomas to look for a global tool if the local tool fails with this specific error? |
Steps to reproduce:
Expected result:
The file is formatted according to the code style.
Actual result:
Nothing happens and no changes are introduced to the file.
Note:
Formatting works fine when I open projects in Windows host. Fantomas-tool is installed in both hosts and I can format files through both PowerShell in Windows and ZSH in WSL2 Debian.
The text was updated successfully, but these errors were encountered: