Skip to content
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

Defer getting all entities as much as possible #2072

Merged
merged 1 commit into from
Dec 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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