Skip to content

Commit

Permalink
Update long secondary constructor parameters. (fsprojects#3038)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nojaf authored Jan 27, 2024
1 parent d8f44db commit de8ac50
Show file tree
Hide file tree
Showing 19 changed files with 559 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"fsdocs-tool": {
"version": "20.0.0-alpha-010",
"version": "20.0.0-alpha-018",
"commands": [
"fsdocs"
]
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## Unreleased
## 6.3.0-alpha-007 - 2024-01-27

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

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

Expand Down
33 changes: 2 additions & 31 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#r "nuget: Humanizer.Core, 2.14.1"

open System
open System.Text.Json
open System.IO
open Fun.Build
open CliWrap
Expand All @@ -28,34 +27,6 @@ let cleanFolders (input: string seq) =
Directory.Delete(dir, true))
}

/// Workaround for https://github.com/dotnet/sdk/issues/35989
let restoreTools (ctx: Internal.StageContext) =
async {
let json = File.ReadAllText ".config/dotnet-tools.json"
let jsonDocument = JsonDocument.Parse(json)
let root = jsonDocument.RootElement
let tools = root.GetProperty("tools")

let! installs =
tools.EnumerateObject()
|> Seq.map (fun tool ->
let version = tool.Value.GetProperty("version").GetString()
ctx.RunCommand $"dotnet tool install %s{tool.Name} --version %s{version}")
|> Async.Sequential

let failedInstalls =
installs
|> Array.tryPick (function
| Ok _ -> None
| Error error -> Some error)

match failedInstalls with
| None -> return 0
| Some error ->
printfn $"%s{error}"
return 1
}

let benchmarkAssembly =
"src"
</> "Fantomas.Benchmarks"
Expand Down Expand Up @@ -90,7 +61,7 @@ let analysisReportsDir = "analysisreports"

pipeline "Build" {
workingDir __SOURCE_DIRECTORY__
stage "RestoreTools" { run restoreTools }
stage "RestoreTools" { run "dotnet tool restore" }
stage "Clean" {
run (
cleanFolders
Expand Down Expand Up @@ -200,7 +171,7 @@ pipeline "PushClient" {
pipeline "Docs" {
workingDir __SOURCE_DIRECTORY__
stage "Prepare" {
run restoreTools
run "dotnet tool restore"
run "dotnet build -c Release src/Fantomas/Fantomas.fsproj"
}
stage "Watch" {
Expand Down
3 changes: 3 additions & 0 deletions docs/content/configuration.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ h3 {
padding-inline: var(--spacing-100);
font-size: var(--font-300);
max-width: calc(100% - var(--configuration-icon-size) - var(--configuration-icon-size) - var(--spacing-100) - var(--spacing-100));
& a {
padding-top: var(--spacing-600);
}
}

p > fantomas-setting, p > copy-to-clipboard {
Expand Down
2 changes: 1 addition & 1 deletion docs/content/fsdocs-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ h1,h2,h3,h4,h5,h6 {
}
}

#fsdocs-page-menu {
#fsdocs-page-menu ul li {
& a {
color: var(--fantomas-600);
}
Expand Down
190 changes: 99 additions & 91 deletions docs/content/webcomponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ class Navigation extends LitElement {
a {
margin-top: var(--spacing-200);
color: var(--link-color);
color: var(--fantomas-800);
display: inline-block;
text-decoration: none;
background-color: var(--fantomas-200);
padding: var(--spacing-50) var(--spacing-100);
}
a:hover {
background-color: var(--fantomas-400);
color: var(--fantomas-50);
}
a:only-child {
text-align: center;
flex: 1;
margin-inline: auto;
}
`;

Expand Down Expand Up @@ -93,7 +101,7 @@ class CopyToClipboard extends LitElement {
margin: 0;
transition: all 200ms;
position: absolute;
z-index: 1;
z-index: 101;
left: 50%;
transform: translateX(-50%);
bottom: 100%;
Expand Down Expand Up @@ -146,113 +154,113 @@ class FantomasSetting extends LitElement {
}

static styles = css`
:host {
display: inline-block;
}
:host {
display: inline-block;
}
:host([green]) iconify-icon {
color: #92DC84;
}
:host([green]) iconify-icon {
color: #92DC84;
}
:host([green]) .tooltip {
background-color: #92DC84;
}
:host([green]) .tooltip {
background-color: #92DC84;
}
:host([green]) .tooltip::after {
border-color: #92DC84 transparent transparent transparent;
}
:host([green]) .tooltip::after {
border-color: #92DC84 transparent transparent transparent;
}
:host([orange]) iconify-icon {
color: #F5BF4F;
}
:host([orange]) iconify-icon {
color: #F5BF4F;
}
:host([orange]) .tooltip {
background-color: #F5BF4F;
}
:host([orange]) .tooltip {
background-color: #F5BF4F;
}
:host([orange]) .tooltip::after {
border-color: #F5BF4F transparent transparent transparent;
}
:host([orange]) .tooltip::after {
border-color: #F5BF4F transparent transparent transparent;
}
:host([red]) iconify-icon {
color: #EA7268;
}
:host([red]) iconify-icon {
color: #EA7268;
}
:host([red]) .tooltip {
background-color: #EA7268;
}
:host([red]) .tooltip {
background-color: #EA7268;
}
:host([red]) .tooltip::after {
border-color: #EA7268 transparent transparent transparent;
}
:host([red]) .tooltip::after {
border-color: #EA7268 transparent transparent transparent;
}
:host([gr]) iconify-icon {
color: #00A8E2;
}
:host([gr]) iconify-icon {
color: #00A8E2;
}
:host([gr]) .tooltip {
background-color: #00A8E2;
}
:host([gr]) .tooltip {
background-color: #00A8E2;
}
:host([gr]) .tooltip::after {
border-color: #00A8E2 transparent transparent transparent;
}
:host([gr]) .tooltip::after {
border-color: #00A8E2 transparent transparent transparent;
}
div {
height: var(--configuration-icon-size);
position: relative;
}
div {
height: var(--configuration-icon-size);
position: relative;
}
img {
box-sizing: border-box;
padding: 4px;
background-color: #00A8E2;
height: var(--configuration-icon-size);
width: var(--configuration-icon-size);
border-radius: 12px;
display: inline-block;
}
img {
box-sizing: border-box;
padding: 4px;
background-color: #00A8E2;
height: var(--configuration-icon-size);
width: var(--configuration-icon-size);
border-radius: 12px;
display: inline-block;
}
img, iconify-icon {
position: relative;
cursor: pointer;
img, iconify-icon {
position: relative;
cursor: pointer;
&:hover + .tooltip {
visibility: visible;
opacity: 1;
&:hover + .tooltip {
visibility: visible;
opacity: 1;
}
}
}
.tooltip {
visibility: hidden;
opacity: 0;
white-space: nowrap;
font-size: 14px;
line-height: 1.5;
background-color: rgba(0, 0, 0, .95);
color: #FFF;
text-align: center;
border-radius: var(--radius);
padding: var(--spacing-100);
margin: 0;
transition: all 200ms;
position: absolute;
z-index: 1;
left: 50%;
transform: translateX(-50%);
bottom: 100%;
&::after {
content: " ";
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border-width: var(--radius);
border-style: solid;
border-color: rgba(0, 0, 0, .95) transparent transparent transparent;
.tooltip {
visibility: hidden;
opacity: 0;
white-space: nowrap;
font-size: 14px;
line-height: 1.5;
background-color: rgba(0, 0, 0, .95);
color: #FFF;
text-align: center;
border-radius: var(--radius);
padding: var(--spacing-100);
margin: 0;
transition: all 200ms;
position: absolute;
z-index: 101;
left: 50%;
transform: translateX(-50%);
bottom: 100%;
&::after {
content: " ";
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border-width: var(--radius);
border-style: solid;
border-color: rgba(0, 0, 0, .95) transparent transparent transparent;
}
}
}
`;

constructor(props) {
Expand Down
8 changes: 8 additions & 0 deletions docs/docs/end-users/Configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,14 @@ type D() =
aThirdVeryLongParam: AVeryLongTypeThatYouNeedToUse
) : ReturnType =
42
type E() =
new
(
aVeryLongType: AVeryLongTypeThatYouNeedToUse,
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse,
aThirdVeryLongType: AVeryLongTypeThatYouNeedToUse
) = E()
"""
{ FormatConfig.Default with
AlternativeLongMemberDefinitions = true }
Expand Down
5 changes: 1 addition & 4 deletions src/Fantomas.Core.Tests/AlignedMultilineBracketStyleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,7 @@ type RequestParser<'ctx, 'a> =
}
static member internal Create
(
consumedFields,
parse : 'ctx -> Request -> Async<Result<'a, Error list>>
)
(consumedFields, parse : 'ctx -> Request -> Async<Result<'a, Error list>>)
: RequestParser<'ctx, 'a>
=
{
Expand Down
Loading

0 comments on commit de8ac50

Please sign in to comment.