diff --git a/src/document.jl b/src/document.jl index 22a2e943..fe725ac6 100644 --- a/src/document.jl +++ b/src/document.jl @@ -143,13 +143,7 @@ function Document(text::AbstractString) push!(format_skips, FormatSkip(v[1], line, v[2], last(r))) end - return Document( - srcfile, - format_skips, - noindent_blocks, - comments, - ends_on_nl, - ) + return Document(srcfile, format_skips, noindent_blocks, comments, ends_on_nl) end function has_noindent_block(d::Document, r::Tuple{Int,Int}) diff --git a/src/fst.jl b/src/fst.jl index 7bdcee4e..12cec2af 100644 --- a/src/fst.jl +++ b/src/fst.jl @@ -255,12 +255,9 @@ can_remove(fst::FST) = fst.nest_behavior !== AllowNestButDontRemove Newline(; length = 0, nest_behavior = AllowNest) = FST(NEWLINE, -1, -1, 0, length, "\n", nothing, nest_behavior, 0, -1, nothing) Semicolon() = FST(SEMICOLON, -1, -1, 0, 1, ";", nothing, AllowNest, 0, -1, nothing) -TrailingComma() = - FST(TRAILINGCOMMA, -1, -1, 0, 0, "", nothing, AllowNest, 0, -1, nothing) -Whitespace(n) = - FST(WHITESPACE, -1, -1, 0, n, " "^n, nothing, AllowNest, 0, -1, nothing) -Placeholder(n) = - FST(PLACEHOLDER, -1, -1, 0, n, " "^n, nothing, AllowNest, 0, -1, nothing) +TrailingComma() = FST(TRAILINGCOMMA, -1, -1, 0, 0, "", nothing, AllowNest, 0, -1, nothing) +Whitespace(n) = FST(WHITESPACE, -1, -1, 0, n, " "^n, nothing, AllowNest, 0, -1, nothing) +Placeholder(n) = FST(PLACEHOLDER, -1, -1, 0, n, " "^n, nothing, AllowNest, 0, -1, nothing) Notcode(startline, endline) = FST(NOTCODE, startline, endline, 0, 0, "", nothing, AllowNest, 0, -1, nothing) InlineComment(line) = @@ -1150,7 +1147,15 @@ function add_node!( if isnothing(t.metadata) t.metadata = Metadata(K"begin", false, false, false, false, true, true) else - t.metadata = Metadata(t.metadata.op_kind, t.metadata.op_dotted, t.metadata.is_standalone_shortcircuit, t.metadata.is_short_form_function, t.metadata.is_assignment, t.metadata.is_long_form_function, true) + t.metadata = Metadata( + t.metadata.op_kind, + t.metadata.op_dotted, + t.metadata.is_standalone_shortcircuit, + t.metadata.is_short_form_function, + t.metadata.is_assignment, + t.metadata.is_long_form_function, + true, + ) end if is_iterable(t) && n_args(t) > 1 t.nest_behavior = AlwaysNest diff --git a/src/styles/default/pretty.jl b/src/styles/default/pretty.jl index 90d763dd..20949e75 100644 --- a/src/styles/default/pretty.jl +++ b/src/styles/default/pretty.jl @@ -504,19 +504,7 @@ function p_stringh( for (i, l) in enumerate(lines) ln = startline + i - 1 l = i == 1 ? l : l[sidx:end] - n = FST( - LITERAL, - ln, - ln, - sidx - 1, - length(l), - l, - nothing, - AllowNest, - 0, - -1, - nothing, - ) + n = FST(LITERAL, ln, ln, sidx - 1, length(l), l, nothing, AllowNest, 0, -1, nothing) add_node!(t, n, s) end @@ -541,7 +529,12 @@ function p_globalrefdoc(ds::DefaultStyle, cst::JuliaSyntax.GreenNode, s::State; args = children(cst) for (i, c) in enumerate(args) if i == 1 - add_node!(t, pretty(style, c, s; kwargs..., from_docstring = true), s, max_padding = 0) + add_node!( + t, + pretty(style, c, s; kwargs..., from_docstring = true), + s, + max_padding = 0, + ) elseif i == length(args) add_node!(t, pretty(style, c, s; kwargs...), s, max_padding = 0) else