Skip to content

Commit

Permalink
Members hidden from IntelliSense are now also omitted in QuickInfo - f…
Browse files Browse the repository at this point in the history
…ixes #50
  • Loading branch information
forki committed Jan 21, 2015
1 parent 2bc78bc commit fdfc783
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ module private TastDefinitionPrinting =
not (isInterfaceTy denv.g oty)
| [] -> true)
|> List.filter (fun v -> denv.showObsoleteMembers || not (HasFSharpAttribute denv.g denv.g.attrib_SystemObsolete v.Attribs))
|> List.filter (fun v -> not (Infos.AttributeChecking.CheckFSharpAttributesForHidden denv.g v.Attribs))
// sort
let sortKey (v:ValRef) = (not v.IsConstructor, // constructors before others
v.Id.idText, // sort by name
Expand Down
21 changes: 13 additions & 8 deletions src/fsharp/infos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2637,20 +2637,25 @@ module AttributeChecking =
let (AttribInfo(tref,_)) = g.attrib_SystemObsolete
isSome (TryDecodeILAttribute g tref (Some(tref.Scope)) cattrs)

/// Checks the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
/// items to be suppressed from intellisense.
let CheckFSharpAttributesForHidden g attribs =
nonNil attribs &&
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribs with
| Some(Attrib(_,_,[AttribStringArg _; AttribInt32Arg messageNumber],
ExtractAttribNamedArg "IsHidden" (AttribBoolArg v),_,_,_)) ->
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
// when mlCompatibility is set.
v && not (messageNumber = 62 && g.mlCompatibility)
| _ -> false)

/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
/// Also check the attributes for CompilerMessageAttribute, which has an IsHidden argument that allows
/// items to be suppressed from intellisense.
let CheckFSharpAttributesForUnseen g attribs _m =
nonNil attribs &&
(let isObsolete = isSome (TryFindFSharpAttribute g g.attrib_SystemObsolete attribs)
let isHidden =
(match TryFindFSharpAttribute g g.attrib_CompilerMessageAttribute attribs with
| Some(Attrib(_,_,[AttribStringArg _; AttribInt32Arg messageNumber],
ExtractAttribNamedArg "IsHidden" (AttribBoolArg v),_,_,_)) ->
// Message number 62 is for "ML Compatibility". Items labelled with this are visible in intellisense
// when mlCompatibility is set.
v && not (messageNumber = 62 && g.mlCompatibility)
| _ -> false)
let isHidden = CheckFSharpAttributesForHidden g attribs
isObsolete || isHidden
)

Expand Down

0 comments on commit fdfc783

Please sign in to comment.