Skip to content

Commit

Permalink
Sequentialize GetAllUsesOfAllSymolsInFile (dotnet#10357)
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermp authored Nov 6, 2020
1 parent fc0e411 commit 17d120b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 18 deletions.
3 changes: 0 additions & 3 deletions CodeFix/SimplifyName.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ open System.Composition
open System.Collections.Immutable
open System.Threading.Tasks

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Diagnostics
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.CodeFixes
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
open SymbolHelpers

[<ExportCodeFixProvider(FSharpConstants.FSharpLanguageName, Name = "SimplifyNames"); Shared>]
type internal FSharpSimplifyNameCodeFixProvider() =
Expand Down
4 changes: 3 additions & 1 deletion Common/Extensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module internal Microsoft.VisualStudio.FSharp.Editor.Extensions

open System
open System.IO
open System.Collections.Immutable

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Text
Expand Down Expand Up @@ -243,7 +244,6 @@ module Option =

[<RequireQualifiedAccess>]
module Seq =
open System.Collections.Immutable

let toImmutableArray (xs: seq<'a>) : ImmutableArray<'a> = xs.ToImmutableArray()

Expand All @@ -257,6 +257,8 @@ module Array =
i <- i + 1
state

let toImmutableArray (xs: 'T[]) = xs.ToImmutableArray()

[<RequireQualifiedAccess>]
module Exception =

Expand Down
7 changes: 1 addition & 6 deletions Diagnostics/SimplifyNameDiagnosticAnalyzer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ open System.Composition
open System.Collections.Immutable
open System.Diagnostics
open System.Threading
open System.Threading.Tasks

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Diagnostics
open FSharp.Compiler
open FSharp.Compiler.Range
open System.Runtime.Caching
open Microsoft.CodeAnalysis.Host.Mef
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
open FSharp.Compiler.SourceCodeServices

type private TextVersionHash = int
type private PerDocumentSavedData = { Hash: int; Diagnostics: ImmutableArray<Diagnostic> }

[<Export(typeof<IFSharpSimplifyNameDiagnosticAnalyzer>)>]
Expand All @@ -36,7 +31,7 @@ type internal SimplifyNameDiagnosticAnalyzer [<ImportingConstructor>] () =

interface IFSharpSimplifyNameDiagnosticAnalyzer with

member this.AnalyzeSemanticsAsync(descriptor, document: Document, cancellationToken: CancellationToken) =
member _.AnalyzeSemanticsAsync(descriptor, document: Document, cancellationToken: CancellationToken) =
asyncMaybe {
do! Option.guard document.FSharpOptions.CodeFixes.SimplifyName
do Trace.TraceInformation("{0:n3} (start) SimplifyName", DateTime.Now.TimeOfDay.TotalSeconds)
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/UnusedDeclarationsAnalyzer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type internal UnusedDeclarationsAnalyzer [<ImportingConstructor>] () =

interface IFSharpUnusedDeclarationsDiagnosticAnalyzer with

member __.AnalyzeSemanticsAsync(descriptor, document, cancellationToken) =
member _.AnalyzeSemanticsAsync(descriptor, document, cancellationToken) =
asyncMaybe {
do! Option.guard document.FSharpOptions.CodeFixes.UnusedDeclarations

Expand Down
7 changes: 0 additions & 7 deletions Diagnostics/UnusedOpensDiagnosticAnalyzer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ open System.Composition
open System.Collections.Immutable
open System.Diagnostics
open System.Threading
open System.Threading.Tasks

open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.Text
open Microsoft.CodeAnalysis.Diagnostics

open FSharp.Compiler
open FSharp.Compiler.Range
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.SyntaxTree

open Microsoft.VisualStudio.FSharp.Editor.Symbols
open Microsoft.CodeAnalysis.Host.Mef
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics

[<Export(typeof<IFSharpUnusedOpensDiagnosticAnalyzer>)>]
Expand Down

0 comments on commit 17d120b

Please sign in to comment.