Skip to content

Tooltips for types should show direct base types only #18586

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
7 changes: 6 additions & 1 deletion src/Compiler/Checking/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,7 @@ module TastDefinitionPrinting =
GetIntrinsicConstructorInfosOfType infoReader m ty
|> List.filter (fun minfo -> IsMethInfoAccessible amap m ad minfo && not minfo.IsClassConstructor && shouldShow minfo.ArbitraryValRef)

// Get base interfaces (either direct or all, depending on settings)
let iimpls =
if suppressInheritanceAndInterfacesForTyInSimplifiedDisplays g amap m ty then
[]
Expand All @@ -2058,7 +2059,11 @@ module TastDefinitionPrinting =
|> List.filter (fun (_, compgen, _) -> not compgen)
|> List.map p13
else
GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes g amap m ty
// Use immediate interfaces when showOnlyDirectBaseTypes=true, otherwise show all interfaces
if denv.showOnlyDirectBaseTypes then
GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes g amap m ty
else
AllInterfacesOfType g amap m AllowMultiIntfInstantiations.Yes ty

let iimplsLs =
iimpls
Expand Down
4 changes: 3 additions & 1 deletion src/Compiler/Service/ServiceDeclarationLists.fs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,9 @@ module DeclarationListHelpers =
// tooltips are space-constrained, so don't include xml doc comments
// on types/members. The doc comments for the actual member will still
// be shown in the tip.
showDocumentation = false }
showDocumentation = false
// only show direct base types in tooltips
showOnlyDirectBaseTypes = true }
let layout = NicePrint.layoutTyconDefn denv infoReader ad m (* width *) tcref.Deref
let layout = PrintUtilities.squashToWidth width layout
let remarks = OutputFullName displayFullName pubpathOfTyconRef fullDisplayTextOfTyconRefAsLayout tcref
Expand Down
5 changes: 4 additions & 1 deletion src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3200,6 +3200,7 @@ type DisplayEnv =
shrinkOverloads: bool
printVerboseSignatures: bool
escapeKeywordNames: bool
showOnlyDirectBaseTypes: bool
g: TcGlobals
contextAccessibility: Accessibility
generatedValueLayout : Val -> Layout option
Expand Down Expand Up @@ -3238,6 +3239,7 @@ type DisplayEnv =
shrinkOverloads = true
printVerboseSignatures = false
escapeKeywordNames = false
showOnlyDirectBaseTypes = false
g = tcGlobals
contextAccessibility = taccessPublic
generatedValueLayout = (fun _ -> None)
Expand Down Expand Up @@ -3267,7 +3269,8 @@ type DisplayEnv =
showDocumentation = true
shrinkOverloads = false
escapeKeywordNames = true
includeStaticParametersInTypeNames = true }
includeStaticParametersInTypeNames = true
showOnlyDirectBaseTypes = false }
denv.SetOpenPaths
[ FSharpLib.RootPath
FSharpLib.CorePath
Expand Down
1 change: 1 addition & 0 deletions src/Compiler/TypedTree/TypedTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ type DisplayEnv =
showCsharpCodeAnalysisAttributes: bool
showOverrides: bool
showStaticallyResolvedTyparAnnotations: bool
showOnlyDirectBaseTypes: bool
showNullnessAnnotations: bool option
abbreviateAdditionalConstraints: bool
showTyparDefaultConstraints: bool
Expand Down
Loading