Skip to content

Commit

Permalink
Defer getting all entities as much as possible (#2072)
Browse files Browse the repository at this point in the history
  • Loading branch information
dungpa authored and KevinRansom committed Dec 22, 2016
1 parent 5f206cd commit a00791b
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ type internal FSharpAddOpenCodeFixProvider
match parseResults.ParseTree, checkFileAnswer with
| None, _
| _, FSharpCheckFileAnswer.Aborted -> ()
| Some parsedInput, FSharpCheckFileAnswer.Succeeded(checkFileResults) ->
let entities = assemblyContentProvider.GetAllEntitiesInProjectAndReferencedAssemblies checkFileResults
| Some parsedInput, FSharpCheckFileAnswer.Succeeded checkFileResults ->
let textLinePos = sourceText.Lines.GetLinePosition context.Span.Start
let defines = CompilerEnvironment.GetCompilationDefinesForEditing(context.Document.FilePath, options.OtherOptions |> Seq.toList)
let symbol = CommonHelpers.getSymbolAtPosition(context.Document.Id, sourceText, context.Span.Start, context.Document.FilePath, defines, SymbolLookupKind.Fuzzy)
Expand All @@ -188,20 +187,17 @@ type internal FSharpAddOpenCodeFixProvider
| None -> ()
| Some entityKind ->
let isAttribute = entityKind = EntityKind.Attribute

let entities =
entities |> List.filter (fun e ->
assemblyContentProvider.GetAllEntitiesInProjectAndReferencedAssemblies checkFileResults
|> List.filter (fun e ->
match entityKind, e.Kind with
| EntityKind.Attribute, EntityKind.Attribute
| EntityKind.Type, (EntityKind.Type | EntityKind.Attribute)
| EntityKind.FunctionOrValue _, _ -> true
| EntityKind.Attribute, _
| _, EntityKind.Module _
| EntityKind.Module _, _
| EntityKind.Type, _ -> false)

let entities =
entities
| EntityKind.Type, _ -> false)
|> List.map (fun e ->
[ yield e.TopRequireQualifiedAccessParent, e.AutoOpenParent, e.Namespace, e.CleanedIdents
if isAttribute then
Expand Down

0 comments on commit a00791b

Please sign in to comment.