Skip to content

Commit

Permalink
better support for loading csharp dlls (we need IsFSharp to be true t…
Browse files Browse the repository at this point in the history
…o get all methods in "MembersFunctionsAndValues"). This will be used by FSharp.Formatting for example.
  • Loading branch information
matthid committed Jan 2, 2015
1 parent 4b6d8db commit b544581
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/fsharp/vs/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ module Impl =
match ItemDescriptionsImpl.GetXmlDocSigOfEntityRef cenv.infoReader ent.Range ent with
| Some (_, docsig) -> docsig
| _ -> ""

let getItem (ent:EntityRef) =
checkEntityIsResolved(ent)
if ent.IsModule then Item.ModuleOrNamespaces [ent]
else Item.UnqualifiedType [ent]

type FSharpDisplayContext(denv: TcGlobals -> DisplayEnv) =
member x.Contents(g) = denv(g)
Expand Down Expand Up @@ -179,10 +184,7 @@ type FSharpSymbol(cenv:cenv, item: (unit -> Item), access: (FSharpSymbol -> CcuT

and FSharpEntity(cenv:cenv, entity:EntityRef) =
inherit FSharpSymbol(cenv,
(fun () ->
checkEntityIsResolved(entity);
if entity.IsModule then Item.ModuleOrNamespaces [entity]
else Item.UnqualifiedType [entity]),
(fun () -> getItem(entity)),
(fun _this thisCcu2 ad ->
checkForCrossProjectAccessibility (thisCcu2, ad) (cenv.thisCcu, getApproxFSharpAccessibilityOfEntity entity))
// && AccessibilityLogic.IsEntityAccessible cenv.amap range0 ad entity)
Expand All @@ -194,7 +196,9 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
let isResolvedAndFSharp() =
match entity with
| ERefNonLocal(NonLocalEntityRef(ccu, _)) -> not ccu.IsUnresolvedReference && ccu.IsFSharp
| _ -> true
| _ ->
let ccu = defaultArg (ItemDescriptionsImpl.ccuOfItem cenv.g (getItem entity)) cenv.thisCcu
ccu.IsFSharp

let isUnresolved() = entityIsUnresolved entity
let isResolved() = not (isUnresolved())
Expand Down Expand Up @@ -1788,7 +1792,7 @@ and FSharpAssembly internal (cenv, ccu: CcuThunk) =
member __.FileName = ccu.FileName
member __.SimpleName = ccu.AssemblyName
member __.IsProviderGenerated = ccu.IsProviderGenerated
member __.Contents = FSharpAssemblySignature(cenv, ccu.Contents.ModuleOrNamespaceType)
member __.Contents = FSharpAssemblySignature((if ccu.IsUnresolvedReference then cenv else (new cenv(cenv.g, ccu, cenv.tcImports))), ccu.Contents.ModuleOrNamespaceType)

override x.ToString() = x.QualifiedName

Expand Down

0 comments on commit b544581

Please sign in to comment.