Skip to content

Commit 4e3a440

Browse files
cartermpbaronfel
authored andcommitted
Add get/set to item description tooltip (#7016)
* Add get/set to item description tooltip * Fix QuickInfo test * Adjust gettersetter layout * Tag the keyword again
1 parent e47b867 commit 4e3a440

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

fcs/FSharp.Compiler.Service.Tests/QuickInfoTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,6 @@ module Test =
440440
}
441441
"""
442442
let quickInfo = GetQuickInfoTextFromCode code
443-
let expected = "property MyDistance.asNautical: MyDistance"
443+
let expected = "property MyDistance.asNautical: MyDistance with get"
444444
Assert.AreEqual(expected, quickInfo)
445445
()

src/fsharp/NicePrint.fs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,12 +1405,24 @@ module InfoMemberPrinting =
14051405
| None -> tagProperty
14061406
| Some vref -> tagProperty >> mkNav vref.DefinitionRange
14071407
let nameL = DemangleOperatorNameAsLayout tagProp pinfo.PropertyName
1408+
let getterSetter =
1409+
match pinfo.HasGetter, pinfo.HasSetter with
1410+
| (true, false) ->
1411+
wordL (tagKeyword "with") ^^ wordL (tagText "get")
1412+
| (false, true) ->
1413+
wordL (tagKeyword "with") ^^ wordL (tagText "set")
1414+
| (true, true) ->
1415+
wordL (tagKeyword "with") ^^ wordL (tagText "get, set")
1416+
| (false, false) ->
1417+
emptyL
1418+
14081419
wordL (tagText (FSComp.SR.typeInfoProperty())) ^^
14091420
layoutTyconRef denv pinfo.ApparentEnclosingTyconRef ^^
14101421
SepL.dot ^^
14111422
nameL ^^
14121423
RightL.colon ^^
1413-
layoutType denv rty
1424+
layoutType denv rty ^^
1425+
getterSetter
14141426

14151427
let formatMethInfoToBufferFreeStyle amap m denv os (minfo: MethInfo) =
14161428
let _, resL = prettyLayoutOfMethInfoFreeStyle amap m denv emptyTyparInst minfo

0 commit comments

Comments
 (0)