Skip to content

Commit

Permalink
Obsolete members are now also omitted in QuickInfo - references #50
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jan 21, 2015
1 parent 8c458f2 commit 0aca37a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,8 +1504,8 @@ module private TastDefinitionPrinting =
// Don't print individual methods forming interface implementations - these are currently never exported
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))
|> List.filter (fun v -> denv.showObsoleteMembers || not (Infos.AttributeChecking.CheckFSharpAttributesForObsolete denv.g v.Attribs))
|> List.filter (fun v -> denv.showHiddenMembers || 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
6 changes: 4 additions & 2 deletions src/fsharp/fsc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,13 @@ let runFromCommandLineToImportingAssemblies(displayPSTypeProviderSecurityDialogB
// Code from here on down is just used by fsc.exe
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

let BuildInitialDisplayEnvForDocGeneration tcGlobals =
let BuildInitialDisplayEnvForSigFileGeneration tcGlobals =
let denv = DisplayEnv.Empty tcGlobals
let denv =
{ denv with
showImperativeTyparAnnotations=true;
showHiddenMembers=true;
showObsoleteMembers=true;
showAttributes=true; }
denv.SetOpenPaths
[ FSharpLib.RootPath
Expand All @@ -577,7 +579,7 @@ module InterfaceFileWriter =
fprintfn os ""

for (TImplFile(_,_,mexpr,_,_)) in declaredImpls do
let denv = BuildInitialDisplayEnvForDocGeneration tcGlobals
let denv = BuildInitialDisplayEnvForSigFileGeneration tcGlobals
writeViaBufferWithEnvironmentNewLines os (fun os s -> Printf.bprintf os "%s\n\n" s)
(NicePrint.layoutInferredSigOfModuleExpr true denv infoReader AccessibleFromSomewhere range0 mexpr |> Layout.squashTo 80 |> Layout.showL)

Expand Down
12 changes: 7 additions & 5 deletions src/fsharp/infos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,15 +2649,17 @@ module AttributeChecking =
v && not (messageNumber = 62 && g.mlCompatibility)
| _ -> false)

/// Indicate if a list of F# attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
let CheckFSharpAttributesForObsolete g attribs =
nonNil attribs && (HasFSharpAttribute g g.attrib_SystemObsolete attribs)

/// 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 = CheckFSharpAttributesForHidden g attribs
isObsolete || isHidden
)
nonNil attribs &&
(CheckFSharpAttributesForObsolete g attribs ||
CheckFSharpAttributesForHidden g attribs)

#if EXTENSIONTYPING
/// Indicate if a list of provided attributes contains 'ObsoleteAttribute'. Used to suppress the item in intellisense.
Expand Down
4 changes: 3 additions & 1 deletion src/fsharp/tastops.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2354,6 +2354,7 @@ type DisplayEnv =
suppressNestedTypes: bool;
maxMembers : int option;
showObsoleteMembers: bool;
showHiddenMembers: bool;
showTyparBinding: bool;
showImperativeTyparAnnotations: bool;
suppressInlineKeyword: bool;
Expand Down Expand Up @@ -2384,7 +2385,8 @@ type DisplayEnv =
shortTypeNames=false;
suppressNestedTypes=false;
maxMembers=None;
showObsoleteMembers=true;
showObsoleteMembers=false;
showHiddenMembers=false;
showTyparBinding = false;
showImperativeTyparAnnotations=false;
suppressInlineKeyword=false;
Expand Down
1 change: 1 addition & 0 deletions src/fsharp/tastops.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ type DisplayEnv =
suppressNestedTypes: bool;
maxMembers : int option;
showObsoleteMembers: bool;
showHiddenMembers: bool;
showTyparBinding: bool;
showImperativeTyparAnnotations: bool;
suppressInlineKeyword:bool;
Expand Down

0 comments on commit 0aca37a

Please sign in to comment.