Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve consistency of val signatures #1063

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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