Skip to content

Commit

Permalink
Remove SourceText CLI option
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Oct 12, 2023
1 parent 6a29581 commit da0df4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
3 changes: 0 additions & 3 deletions src/FsAutoComplete.Core/FileSystem.fs
Expand Up @@ -382,9 +382,6 @@ module RoslynSourceText =
member _.CopyTo(sourceIndex, destination, destinationIndex, count) =
sourceText.CopyTo(sourceIndex, destination, destinationIndex, count)




type ISourceTextFactory =
abstract member Create: fileName: string<LocalPath> * text: string -> IFSACSourceText
abstract member Create: fileName: string<LocalPath> * stream: Stream -> CancellableValueTask<IFSACSourceText>
Expand Down
30 changes: 3 additions & 27 deletions src/FsAutoComplete/Parser.fs
Expand Up @@ -9,27 +9,17 @@ open System.CommandLine
open System.CommandLine.Parsing
open System.CommandLine.Builder
open Serilog.Filters
open System.Runtime.InteropServices
open System.Threading.Tasks
open FsAutoComplete.Lsp
open OpenTelemetry
open OpenTelemetry.Resources
open OpenTelemetry.Trace

type SourceTextFactoryOptions =
| NamedText = 0
| RoslynSourceText = 1



module Parser =
open FsAutoComplete.Core
open System.Diagnostics

let mutable tracerProvider = Unchecked.defaultof<_>



[<Struct>]
type Pos = { Line: int; Column: int }

Expand Down Expand Up @@ -103,14 +93,6 @@ module Parser =
"Enable LSP Server based on FSharp.Data.Adaptive. Should be more stable, but is experimental."
)

let sourceTextFactoryOption =
Option<SourceTextFactoryOptions>(
"--source-text-factory",
description =
"Set the source text factory to use. RoslynSourceText is the default, uses Roslyn's implementation. NamedText uses an old F# compiler's implementation.",
getDefaultValue = fun () -> SourceTextFactoryOptions.RoslynSourceText
)

let otelTracingOption =
Option<bool>(
"--otel-exporter-enabled",
Expand Down Expand Up @@ -138,25 +120,20 @@ module Parser =
rootCommand.AddOption logLevelOption
rootCommand.AddOption stateLocationOption
rootCommand.AddOption otelTracingOption
rootCommand.AddOption sourceTextFactoryOption

// for back-compat - we removed some options and this broke some clients.
rootCommand.TreatUnmatchedTokensAsErrors <- false

rootCommand.SetHandler(
Func<_, _, _, _, Task>(fun projectGraphEnabled stateDirectory adaptiveLspEnabled sourceTextFactoryOption ->
Func<_, _, _, Task>(fun projectGraphEnabled stateDirectory adaptiveLspEnabled ->
let workspaceLoaderFactory =
fun toolsPath ->
if projectGraphEnabled then
Ionide.ProjInfo.WorkspaceLoaderViaProjectGraph.Create(toolsPath, ProjectLoader.globalProperties)
else
Ionide.ProjInfo.WorkspaceLoader.Create(toolsPath, ProjectLoader.globalProperties)

let sourceTextFactory: ISourceTextFactory =
match sourceTextFactoryOption with
| SourceTextFactoryOptions.NamedText -> new RoslynSourceTextFactory()
| SourceTextFactoryOptions.RoslynSourceText -> new RoslynSourceTextFactory()
| _ -> new RoslynSourceTextFactory()
let sourceTextFactory: ISourceTextFactory = new RoslynSourceTextFactory()

let dotnetPath =
if
Expand All @@ -182,8 +159,7 @@ module Parser =
Task.FromResult result),
projectGraphOption,
stateLocationOption,
adaptiveLspServerOption,
sourceTextFactoryOption
adaptiveLspServerOption
)

rootCommand
Expand Down

0 comments on commit da0df4a

Please sign in to comment.