Skip to content

Commit de8ac50

Browse files
authored
Update long secondary constructor parameters. (#3038)
* Update long secondary constructor parameters. * Update documentation. * Add changelog entry. * Initial attempt to align binding with constructor. * Only indentSepNlnUnindent when pat is tuple inside paren. * Also apply style for ParameterWithTupleTypePattern. * Alpha 7 * Fix header
1 parent d8f44db commit de8ac50

19 files changed

+559
-269
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"fsdocs-tool": {
18-
"version": "20.0.0-alpha-010",
18+
"version": "20.0.0-alpha-018",
1919
"commands": [
2020
"fsdocs"
2121
]

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
## Unreleased
3+
## 6.3.0-alpha-007 - 2024-01-27
44

55
### Changed
66
* Update FCS to 'Parser: parse primary ctor params as normal patterns', commit e2496896c128ccfde33c92f45bbe0d2aa738873a [#3034](https://github.com/fsprojects/fantomas/pull/3034)
7+
* Multiline secondary constructor. [#3037](https://github.com/fsprojects/fantomas/issues/3037) [style guide](https://github.com/dotnet/docs/pull/39096)
78

89
## 6.3.0-alpha-006 - 2024-01-09
910

build.fsx

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#r "nuget: Humanizer.Core, 2.14.1"
66

77
open System
8-
open System.Text.Json
98
open System.IO
109
open Fun.Build
1110
open CliWrap
@@ -28,34 +27,6 @@ let cleanFolders (input: string seq) =
2827
Directory.Delete(dir, true))
2928
}
3029

31-
/// Workaround for https://github.com/dotnet/sdk/issues/35989
32-
let restoreTools (ctx: Internal.StageContext) =
33-
async {
34-
let json = File.ReadAllText ".config/dotnet-tools.json"
35-
let jsonDocument = JsonDocument.Parse(json)
36-
let root = jsonDocument.RootElement
37-
let tools = root.GetProperty("tools")
38-
39-
let! installs =
40-
tools.EnumerateObject()
41-
|> Seq.map (fun tool ->
42-
let version = tool.Value.GetProperty("version").GetString()
43-
ctx.RunCommand $"dotnet tool install %s{tool.Name} --version %s{version}")
44-
|> Async.Sequential
45-
46-
let failedInstalls =
47-
installs
48-
|> Array.tryPick (function
49-
| Ok _ -> None
50-
| Error error -> Some error)
51-
52-
match failedInstalls with
53-
| None -> return 0
54-
| Some error ->
55-
printfn $"%s{error}"
56-
return 1
57-
}
58-
5930
let benchmarkAssembly =
6031
"src"
6132
</> "Fantomas.Benchmarks"
@@ -90,7 +61,7 @@ let analysisReportsDir = "analysisreports"
9061

9162
pipeline "Build" {
9263
workingDir __SOURCE_DIRECTORY__
93-
stage "RestoreTools" { run restoreTools }
64+
stage "RestoreTools" { run "dotnet tool restore" }
9465
stage "Clean" {
9566
run (
9667
cleanFolders
@@ -200,7 +171,7 @@ pipeline "PushClient" {
200171
pipeline "Docs" {
201172
workingDir __SOURCE_DIRECTORY__
202173
stage "Prepare" {
203-
run restoreTools
174+
run "dotnet tool restore"
204175
run "dotnet build -c Release src/Fantomas/Fantomas.fsproj"
205176
}
206177
stage "Watch" {

docs/content/configuration.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ h3 {
33
padding-inline: var(--spacing-100);
44
font-size: var(--font-300);
55
max-width: calc(100% - var(--configuration-icon-size) - var(--configuration-icon-size) - var(--spacing-100) - var(--spacing-100));
6+
& a {
7+
padding-top: var(--spacing-600);
8+
}
69
}
710

811
p > fantomas-setting, p > copy-to-clipboard {

docs/content/fsdocs-theme.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ h1,h2,h3,h4,h5,h6 {
105105
}
106106
}
107107

108-
#fsdocs-page-menu {
108+
#fsdocs-page-menu ul li {
109109
& a {
110110
color: var(--fantomas-600);
111111
}

docs/content/webcomponents.js

Lines changed: 99 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,21 @@ class Navigation extends LitElement {
3131
3232
a {
3333
margin-top: var(--spacing-200);
34-
color: var(--link-color);
34+
color: var(--fantomas-800);
3535
display: inline-block;
36+
text-decoration: none;
37+
background-color: var(--fantomas-200);
38+
padding: var(--spacing-50) var(--spacing-100);
3639
}
40+
41+
a:hover {
42+
background-color: var(--fantomas-400);
43+
color: var(--fantomas-50);
44+
}
3745
3846
a:only-child {
3947
text-align: center;
40-
flex: 1;
48+
margin-inline: auto;
4149
}
4250
`;
4351

@@ -93,7 +101,7 @@ class CopyToClipboard extends LitElement {
93101
margin: 0;
94102
transition: all 200ms;
95103
position: absolute;
96-
z-index: 1;
104+
z-index: 101;
97105
left: 50%;
98106
transform: translateX(-50%);
99107
bottom: 100%;
@@ -146,113 +154,113 @@ class FantomasSetting extends LitElement {
146154
}
147155

148156
static styles = css`
149-
:host {
150-
display: inline-block;
151-
}
157+
:host {
158+
display: inline-block;
159+
}
152160
153-
:host([green]) iconify-icon {
154-
color: #92DC84;
155-
}
161+
:host([green]) iconify-icon {
162+
color: #92DC84;
163+
}
156164
157-
:host([green]) .tooltip {
158-
background-color: #92DC84;
159-
}
165+
:host([green]) .tooltip {
166+
background-color: #92DC84;
167+
}
160168
161-
:host([green]) .tooltip::after {
162-
border-color: #92DC84 transparent transparent transparent;
163-
}
169+
:host([green]) .tooltip::after {
170+
border-color: #92DC84 transparent transparent transparent;
171+
}
164172
165-
:host([orange]) iconify-icon {
166-
color: #F5BF4F;
167-
}
173+
:host([orange]) iconify-icon {
174+
color: #F5BF4F;
175+
}
168176
169-
:host([orange]) .tooltip {
170-
background-color: #F5BF4F;
171-
}
177+
:host([orange]) .tooltip {
178+
background-color: #F5BF4F;
179+
}
172180
173-
:host([orange]) .tooltip::after {
174-
border-color: #F5BF4F transparent transparent transparent;
175-
}
181+
:host([orange]) .tooltip::after {
182+
border-color: #F5BF4F transparent transparent transparent;
183+
}
176184
177-
:host([red]) iconify-icon {
178-
color: #EA7268;
179-
}
185+
:host([red]) iconify-icon {
186+
color: #EA7268;
187+
}
180188
181-
:host([red]) .tooltip {
182-
background-color: #EA7268;
183-
}
189+
:host([red]) .tooltip {
190+
background-color: #EA7268;
191+
}
184192
185-
:host([red]) .tooltip::after {
186-
border-color: #EA7268 transparent transparent transparent;
187-
}
193+
:host([red]) .tooltip::after {
194+
border-color: #EA7268 transparent transparent transparent;
195+
}
188196
189-
:host([gr]) iconify-icon {
190-
color: #00A8E2;
191-
}
197+
:host([gr]) iconify-icon {
198+
color: #00A8E2;
199+
}
192200
193-
:host([gr]) .tooltip {
194-
background-color: #00A8E2;
195-
}
201+
:host([gr]) .tooltip {
202+
background-color: #00A8E2;
203+
}
196204
197-
:host([gr]) .tooltip::after {
198-
border-color: #00A8E2 transparent transparent transparent;
199-
}
205+
:host([gr]) .tooltip::after {
206+
border-color: #00A8E2 transparent transparent transparent;
207+
}
200208
201-
div {
202-
height: var(--configuration-icon-size);
203-
position: relative;
204-
}
209+
div {
210+
height: var(--configuration-icon-size);
211+
position: relative;
212+
}
205213
206-
img {
207-
box-sizing: border-box;
208-
padding: 4px;
209-
background-color: #00A8E2;
210-
height: var(--configuration-icon-size);
211-
width: var(--configuration-icon-size);
212-
border-radius: 12px;
213-
display: inline-block;
214-
}
214+
img {
215+
box-sizing: border-box;
216+
padding: 4px;
217+
background-color: #00A8E2;
218+
height: var(--configuration-icon-size);
219+
width: var(--configuration-icon-size);
220+
border-radius: 12px;
221+
display: inline-block;
222+
}
215223
216-
img, iconify-icon {
217-
position: relative;
218-
cursor: pointer;
224+
img, iconify-icon {
225+
position: relative;
226+
cursor: pointer;
219227
220-
&:hover + .tooltip {
221-
visibility: visible;
222-
opacity: 1;
228+
&:hover + .tooltip {
229+
visibility: visible;
230+
opacity: 1;
231+
}
223232
}
224-
}
225-
226-
.tooltip {
227-
visibility: hidden;
228-
opacity: 0;
229-
white-space: nowrap;
230-
font-size: 14px;
231-
line-height: 1.5;
232-
background-color: rgba(0, 0, 0, .95);
233-
color: #FFF;
234-
text-align: center;
235-
border-radius: var(--radius);
236-
padding: var(--spacing-100);
237-
margin: 0;
238-
transition: all 200ms;
239-
position: absolute;
240-
z-index: 1;
241-
left: 50%;
242-
transform: translateX(-50%);
243-
bottom: 100%;
244233
245-
&::after {
246-
content: " ";
247-
position: absolute;
248-
top: 100%;
249-
left: 50%;
250-
transform: translateX(-50%);
251-
border-width: var(--radius);
252-
border-style: solid;
253-
border-color: rgba(0, 0, 0, .95) transparent transparent transparent;
234+
.tooltip {
235+
visibility: hidden;
236+
opacity: 0;
237+
white-space: nowrap;
238+
font-size: 14px;
239+
line-height: 1.5;
240+
background-color: rgba(0, 0, 0, .95);
241+
color: #FFF;
242+
text-align: center;
243+
border-radius: var(--radius);
244+
padding: var(--spacing-100);
245+
margin: 0;
246+
transition: all 200ms;
247+
position: absolute;
248+
z-index: 101;
249+
left: 50%;
250+
transform: translateX(-50%);
251+
bottom: 100%;
252+
253+
&::after {
254+
content: " ";
255+
position: absolute;
256+
top: 100%;
257+
left: 50%;
258+
transform: translateX(-50%);
259+
border-width: var(--radius);
260+
border-style: solid;
261+
border-color: rgba(0, 0, 0, .95) transparent transparent transparent;
262+
}
254263
}
255-
}
256264
`;
257265

258266
constructor(props) {

docs/docs/end-users/Configuration.fsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,14 @@ type D() =
864864
aThirdVeryLongParam: AVeryLongTypeThatYouNeedToUse
865865
) : ReturnType =
866866
42
867+
868+
type E() =
869+
new
870+
(
871+
aVeryLongType: AVeryLongTypeThatYouNeedToUse,
872+
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse,
873+
aThirdVeryLongType: AVeryLongTypeThatYouNeedToUse
874+
) = E()
867875
"""
868876
{ FormatConfig.Default with
869877
AlternativeLongMemberDefinitions = true }

src/Fantomas.Core.Tests/AlignedMultilineBracketStyleTests.fs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,7 @@ type RequestParser<'ctx, 'a> =
10501050
}
10511051
10521052
static member internal Create
1053-
(
1054-
consumedFields,
1055-
parse : 'ctx -> Request -> Async<Result<'a, Error list>>
1056-
)
1053+
(consumedFields, parse : 'ctx -> Request -> Async<Result<'a, Error list>>)
10571054
: RequestParser<'ctx, 'a>
10581055
=
10591056
{

0 commit comments

Comments
 (0)