Skip to content

Commit

Permalink
Completion: use short item return types
Browse files Browse the repository at this point in the history
  • Loading branch information
auduchinok committed Feb 10, 2025
1 parent c46102f commit da03f82
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type FcsLookupItem(items: RiderDeclarationListItems, context: FSharpCodeCompleti
override x.DisplayTypeName =
try
match getReturnType x.FcsSymbol with
| Some t -> RichText(t.Format(x.FcsSymbolUse.DisplayContext))
| Some t -> RichText(t.Format(x.FcsSymbolUse.DisplayContext.WithShortTypeNames(true)))
| _ -> null
with _ -> null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ type LocalValuesRule() =
if isNull fcsSymbolUse then null else

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

collector.Add(item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type NamedUnionCaseFieldsPatRule() =
let fcsUnionCase = referenceName.Reference.GetFcsSymbol().As<FSharpUnionCase>()
if isNull fcsUnionCase then None else

let displayContext = referenceName.Reference.GetSymbolUse().DisplayContext
let displayContext = referenceName.Reference.GetSymbolUse().DisplayContext.WithShortTypeNames(true)
let fieldNames =
fcsUnionCase.Fields
|> Seq.choose (fun field -> if field.IsNameGenerated then None else Some (field.Name, field.FieldType.Format(displayContext)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ type UnionCasePatternRule() =
if not (matchesType returnType || isFSharpList returnType) then
let text = fcsUnionCase.Name
let fcsEntityInstance = FcsEntityInstance.create returnType
let displayContext = lookupItem.FcsSymbolUse.DisplayContext
let displayContext = lookupItem.FcsSymbolUse.DisplayContext.WithShortTypeNames(true)
let item = createUnionCaseItem fcsEntityInstance returnType displayContext text fcsUnionCase false
unionCaseItems.Add(item)

Expand Down Expand Up @@ -285,6 +285,7 @@ type UnionCasePatternRule() =
let typeName = expectedTypeElement.GetSourceName()

if fcsEntity.IsFSharpUnion then
let displayContext = displayContext.WithShortTypeNames(true)
let requiresQualifiedName = expectedTypeElement.RequiresQualifiedAccess()
for fcsUnionCase in fcsEntity.UnionCases do
let text = if requiresQualifiedName then $"{typeName}.{fcsUnionCase.Name}" else fcsUnionCase.Name
Expand Down

0 comments on commit da03f82

Please sign in to comment.