From ebca9563c9177f6d6a2a812dffe586bfb853735f Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Wed, 3 Nov 2021 08:41:40 +0100 Subject: [PATCH] Create parsingOption via CodeFormatterImpl helper. (#1946) --- src/Fantomas.CoreGlobalTool.Tests/DaemonTests.fs | 2 +- src/Fantomas.CoreGlobalTool/Daemon.fs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Fantomas.CoreGlobalTool.Tests/DaemonTests.fs b/src/Fantomas.CoreGlobalTool.Tests/DaemonTests.fs index 49ad4be099..1a57cf032f 100644 --- a/src/Fantomas.CoreGlobalTool.Tests/DaemonTests.fs +++ b/src/Fantomas.CoreGlobalTool.Tests/DaemonTests.fs @@ -176,7 +176,7 @@ let ``format signature file`` () = formatted "module Foobar -val meh : int +val meh: int " | otherResponse -> Assert.Fail $"Unexpected response %A{otherResponse}" }) diff --git a/src/Fantomas.CoreGlobalTool/Daemon.fs b/src/Fantomas.CoreGlobalTool/Daemon.fs index 07cc30870e..bfe125260a 100644 --- a/src/Fantomas.CoreGlobalTool/Daemon.fs +++ b/src/Fantomas.CoreGlobalTool/Daemon.fs @@ -5,7 +5,6 @@ open System.Diagnostics open System.IO open System.Threading open System.Threading.Tasks -open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Text.Range open FSharp.Compiler.Text.Position open StreamJsonRpc @@ -17,11 +16,6 @@ open Fantomas.SourceOrigin open Fantomas.FormatConfig open Fantomas.Extras.EditorConfig -let private createParsingOptionsFromFile (fileName: string) : FSharpParsingOptions = - { FSharpParsingOptions.Default with - SourceFiles = [| fileName |] - IsExe = true } - type FantomasDaemon(sender: Stream, reader: Stream) as this = let rpc: JsonRpc = JsonRpc.Attach(sender, reader, this) @@ -64,7 +58,7 @@ type FantomasDaemon(sender: Stream, reader: Stream) as this = request.FilePath, SourceString request.SourceCode, config, - createParsingOptionsFromFile request.FilePath, + CodeFormatterImpl.createParsingOptionsFromFile request.FilePath, CodeFormatterImpl.sharedChecker.Value )