-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Wrong anon module formatting when filename starts with a digit #408
Comments
Hmm, not getting this by formatting with command line. |
@nojaf Sorry I forgot to add the initial issue link. |
Ok, I'm able to reproduce this in Rider. I think there are two problems:
For the first problem I'd like to know how Fantomas is called when pressing As for the second problem, |
@nojaf Sure, look at ReformatCode.fs. The first problem looks like a repro for #264. As for the second problem and that option going away I'd be happy to discuss it when the next version is being designed as I think it's quite important to try to preserve user formatting for line endings and that's why we have this option turned on by default. |
Well as might know by now I'm not sure we should preserve user formatting.
Feel free to further discuss in #390. |
R# and IntelliJ do it for other languages. I believe as a user I'd expect it to do it for F# code as well. :) Thanks, I'll try to add some meaningful input there. |
Is there any way of knowing the value of parsedInput ? |
It's coming from FSharpChecker.ParseFile, called inside FSharpCheckerService.fs. It should be the same result as when using FSharp.Compiler.Sevice.dll from NuGet inside a script, at least before the recently (yesterday?) released FCS, due to changes in dotnet/fsharp#6027 which help with dealing with anon modules. |
Yeah I knew it would have to come from |
It's default options with file name set and let getParsingOptionsForSingleFile (file: IPsiSourceFile) =
{ FSharpParsingOptions.Default with SourceFiles = [| file.GetLocation().FullPath |] } member x.GetParsingOptions(file) =
if isScriptLike file then { getParsingOptionsForSingleFile file with IsExe = true } else
getOrCreateFSharpProject file
|> Option.map (fun fsProject -> fsProject.ParsingOptions)
|> Option.defaultWith (fun _ -> getParsingOptionsForSingleFile file) |
Ok, thanks for all the pointers. I can try and write a unit test now. |
I can't reproduce this anymore in Rider. |
Consider file
60Seconds.fsx
with following content:It's being formatted to
The text was updated successfully, but these errors were encountered: