Skip to content

Commit

Permalink
improve consistency of val signatures (#1063)
Browse files Browse the repository at this point in the history
  • Loading branch information
dawedawe authored Feb 25, 2023
1 parent 3498a06 commit 4064e02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/FsAutoComplete.Core/SignatureFormatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,8 @@ module SignatureFormatter =
| _ -> None

match constraints with
| Some constraints -> prefix ++ name ++ ":" ++ constraints
| None -> prefix ++ name ++ ":" ++ retType
| Some constraints -> prefix ++ name + ":" ++ constraints
| None -> prefix ++ name + ":" ++ retType

let getFieldSignature displayContext (field: FSharpField) =
let retType = formatFSharpType displayContext field.FieldType
Expand Down
16 changes: 8 additions & 8 deletions test/FsAutoComplete.Tests.Lsp/CoreTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ let tooltipTests state =
""
"Used to associate, or bind, a name to a value or function."
"" ] // `let` keyword
verifySignature 0 4 "val arrayOfTuples : (int * int) array" // verify that even the first letter of the tooltip triggers correctly
verifySignature 0 5 "val arrayOfTuples : (int * int) array" // inner positions trigger
verifySignature 1 5 "val listOfTuples : list<int * int>" // verify we default to prefix-generics style
verifySignature 2 5 "val listOfStructTuples : list<struct (int * int)>" // verify we render struct tuples in a round-tripabble format
verifySignature 3 5 "val floatThatShouldHaveGenericReportedInTooltip : float" // verify we strip <MeasureOne> measure annotations
verifySignature 0 4 "val arrayOfTuples: (int * int) array" // verify that even the first letter of the tooltip triggers correctly
verifySignature 0 5 "val arrayOfTuples: (int * int) array" // inner positions trigger
verifySignature 1 5 "val listOfTuples: list<int * int>" // verify we default to prefix-generics style
verifySignature 2 5 "val listOfStructTuples: list<struct (int * int)>" // verify we render struct tuples in a round-tripabble format
verifySignature 3 5 "val floatThatShouldHaveGenericReportedInTooltip: float" // verify we strip <MeasureOne> measure annotations
verifyDescription
4
4
Expand Down Expand Up @@ -310,9 +310,9 @@ let tooltipTests state =
"**Returns**"
""
"" ]
verifySignature 14 5 "val nestedTuples : int * ((int * int) * int)" // verify that tuples render correctly (parens, etc)
verifySignature 15 5 "val nestedStructTuples : int * struct (int * int)" // verify we can differentiate between struct and non-struct tuples
verifySignature 21 9 "val speed : float<m/s>" // verify we nicely-render measure annotations
verifySignature 14 5 "val nestedTuples: int * ((int * int) * int)" // verify that tuples render correctly (parens, etc)
verifySignature 15 5 "val nestedStructTuples: int * struct (int * int)" // verify we can differentiate between struct and non-struct tuples
verifySignature 21 9 "val speed: float<m/s>" // verify we nicely-render measure annotations
// verify formatting of function-parameters to values. NOTE: we want to wrap them in parens for user clarity eventually.
verifySignature
26
Expand Down

0 comments on commit 4064e02

Please sign in to comment.