Skip to content

Commit da03f82

Browse files
committed
Completion: use short item return types
1 parent c46102f commit da03f82

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/CodeCompletion/FcsLookupItem.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ type FcsLookupItem(items: RiderDeclarationListItems, context: FSharpCodeCompleti
111111
override x.DisplayTypeName =
112112
try
113113
match getReturnType x.FcsSymbol with
114-
| Some t -> RichText(t.Format(x.FcsSymbolUse.DisplayContext))
114+
| Some t -> RichText(t.Format(x.FcsSymbolUse.DisplayContext.WithShortTypeNames(true)))
115115
| _ -> null
116116
with _ -> null
117117

ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/CodeCompletion/Rules/LocalValuesRule.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ type LocalValuesRule() =
169169
if isNull fcsSymbolUse then null else
170170

171171
match getReturnType fcsSymbolUse.Symbol with
172-
| Some t -> RichText(t.Format(fcsSymbolUse.DisplayContext))
172+
| Some t -> RichText(t.Format(fcsSymbolUse.DisplayContext.WithShortTypeNames(true)))
173173
| _ -> null
174174

175175
collector.Add(item)

ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/CodeCompletion/Rules/NamedUnionCaseFieldsPatRule.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type NamedUnionCaseFieldsPatRule() =
3535
let fcsUnionCase = referenceName.Reference.GetFcsSymbol().As<FSharpUnionCase>()
3636
if isNull fcsUnionCase then None else
3737

38-
let displayContext = referenceName.Reference.GetSymbolUse().DisplayContext
38+
let displayContext = referenceName.Reference.GetSymbolUse().DisplayContext.WithShortTypeNames(true)
3939
let fieldNames =
4040
fcsUnionCase.Fields
4141
|> Seq.choose (fun field -> if field.IsNameGenerated then None else Some (field.Name, field.FieldType.Format(displayContext)))

ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/CodeCompletion/Rules/UnionCasePatternRule.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ type UnionCasePatternRule() =
255255
if not (matchesType returnType || isFSharpList returnType) then
256256
let text = fcsUnionCase.Name
257257
let fcsEntityInstance = FcsEntityInstance.create returnType
258-
let displayContext = lookupItem.FcsSymbolUse.DisplayContext
258+
let displayContext = lookupItem.FcsSymbolUse.DisplayContext.WithShortTypeNames(true)
259259
let item = createUnionCaseItem fcsEntityInstance returnType displayContext text fcsUnionCase false
260260
unionCaseItems.Add(item)
261261

@@ -285,6 +285,7 @@ type UnionCasePatternRule() =
285285
let typeName = expectedTypeElement.GetSourceName()
286286

287287
if fcsEntity.IsFSharpUnion then
288+
let displayContext = displayContext.WithShortTypeNames(true)
288289
let requiresQualifiedName = expectedTypeElement.RequiresQualifiedAccess()
289290
for fcsUnionCase in fcsEntity.UnionCases do
290291
let text = if requiresQualifiedName then $"{typeName}.{fcsUnionCase.Name}" else fcsUnionCase.Name

0 commit comments

Comments
 (0)