Skip to content

Commit

Permalink
Add get/set to item description tooltip (#7016)
Browse files Browse the repository at this point in the history
* Add get/set to item description tooltip

* Fix QuickInfo test

* Adjust gettersetter layout

* Tag the keyword again
  • Loading branch information
cartermp authored and TIHan committed Jun 20, 2019
1 parent 66a209a commit 51684d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,12 +1405,24 @@ module InfoMemberPrinting =
| None -> tagProperty
| Some vref -> tagProperty >> mkNav vref.DefinitionRange
let nameL = DemangleOperatorNameAsLayout tagProp pinfo.PropertyName
let getterSetter =
match pinfo.HasGetter, pinfo.HasSetter with
| (true, false) ->
wordL (tagKeyword "with") ^^ wordL (tagText "get")
| (false, true) ->
wordL (tagKeyword "with") ^^ wordL (tagText "set")
| (true, true) ->
wordL (tagKeyword "with") ^^ wordL (tagText "get, set")
| (false, false) ->
emptyL

wordL (tagText (FSComp.SR.typeInfoProperty())) ^^
layoutTyconRef denv pinfo.ApparentEnclosingTyconRef ^^
SepL.dot ^^
nameL ^^
RightL.colon ^^
layoutType denv rty
layoutType denv rty ^^
getterSetter

let formatMethInfoToBufferFreeStyle amap m denv os (minfo: MethInfo) =
let _, resL = prettyLayoutOfMethInfoFreeStyle amap m denv emptyTyparInst minfo
Expand Down
2 changes: 1 addition & 1 deletion vsintegration/tests/UnitTests/QuickInfoTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,6 @@ module Test =
}
"""
let quickInfo = GetQuickInfoTextFromCode code
let expected = "property MyDistance.asNautical: MyDistance"
let expected = "property MyDistance.asNautical: MyDistance with get"
Assert.AreEqual(expected, quickInfo)
()

0 comments on commit 51684d4

Please sign in to comment.