Skip to content

Commit c5dfd4d

Browse files
committed
better support for loading csharp dlls (we need IsFSharp to be true to get all methods in "MembersFunctionsAndValues"). This will be used by FSharp.Formatting for example.
1 parent 2b4beaf commit c5dfd4d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/fsharp/vs/Symbols.fs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ module Impl =
8181
cpaths2 |> List.exists (canAccessFromCrossProject taccess1)
8282
| _ -> true // otherwise use the normal check
8383

84+
let getItem (ent:EntityRef) =
85+
checkEntityIsResolved(ent)
86+
if ent.IsModule then Item.ModuleOrNamespaces [ent]
87+
else Item.UnqualifiedType [ent]
88+
8489
let getXmlDocSigForEntity g (tcImports:TcImports) (ent:EntityRef)=
8590
let amap = tcImports.GetImportMap()
8691
let infoReader = InfoReader(g, amap)
@@ -122,10 +127,7 @@ type FSharpSymbol(g:TcGlobals, thisCcu, tcImports, item: (unit -> Item), access:
122127

123128
and FSharpEntity(g:TcGlobals, thisCcu, tcImports: TcImports, entity:EntityRef) =
124129
inherit FSharpSymbol(g, thisCcu, tcImports,
125-
(fun () ->
126-
checkEntityIsResolved(entity);
127-
if entity.IsModule then Item.ModuleOrNamespaces [entity]
128-
else Item.UnqualifiedType [entity]),
130+
(fun () -> getItem(entity)),
129131
(fun _this thisCcu2 ad ->
130132
checkForCrossProjectAccessibility (thisCcu2, ad) (thisCcu, entity.Accessibility))
131133
// && AccessibilityLogic.IsEntityAccessible (tcImports.GetImportMap()) range0 ad entity)
@@ -137,7 +139,9 @@ and FSharpEntity(g:TcGlobals, thisCcu, tcImports: TcImports, entity:EntityRef) =
137139
let isResolvedAndFSharp() =
138140
match entity with
139141
| ERefNonLocal(NonLocalEntityRef(ccu, _)) -> not ccu.IsUnresolvedReference && ccu.IsFSharp
140-
| _ -> true
142+
| _ ->
143+
let ccu = defaultArg (ItemDescriptionsImpl.ccuOfItem g (getItem entity)) thisCcu
144+
ccu.IsFSharp
141145

142146
let isUnresolved() = entityIsUnresolved entity
143147
let isResolved() = not (isUnresolved())
@@ -1661,7 +1665,8 @@ and FSharpAssembly internal (g: TcGlobals, thisCcu, tcImports, ccu: CcuThunk) =
16611665
member __.FileName = ccu.FileName
16621666
member __.SimpleName = ccu.AssemblyName
16631667
member __.IsProviderGenerated = ccu.IsProviderGenerated
1664-
member __.Contents = FSharpAssemblySignature(g, thisCcu, tcImports, ccu.Contents.ModuleOrNamespaceType)
1668+
member __.Contents =
1669+
FSharpAssemblySignature(g, (if ccu.IsUnresolvedReference then thisCcu else ccu), tcImports, ccu.Contents.ModuleOrNamespaceType)
16651670

16661671

16671672
override x.ToString() = x.QualifiedName

0 commit comments

Comments
 (0)