Skip to content
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: 4 additions & 0 deletions HISTORY_v2.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v2.11.4

Fixed a bug where comments from outside docstrings would be incorrectly duplicated inside the docstring if the vertical length of the docstring changed during formatting. (#1223, #1229)

# v2.11.3

Fixed a bug where Julia code in docstrings would be formatted incorrectly if the code itself contained characters that had to be escaped. (#1224, #1228)
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "JuliaFormatter"
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
version = "2.11.3"
version = "2.11.4"
authors = ["Dominique Luna <dluna132@gmail.com> and contributors"]

[workspace]
Expand Down
14 changes: 10 additions & 4 deletions src/styles/default/pretty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -896,17 +896,23 @@ function p_stringh(
end

for (i, l) in enumerate(lines)
ln = startline + i - 1
# When format_docstrings is enabled, the formatted docstring may have more lines
# than the original (e.g. blank lines added around code fences). Clamping prevents
# add_node! from checking source lines outside the docstring for comments. See
# https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/1223
ln = min(startline + i - 1, endline)
l = i == 1 ? l : l[sidx:end]
n = FST(LITERAL, ln, ln, sidx - 1, textwidth(l), l, (), AllowNest, 0, -1, nothing)
add_node!(t, n, s)
# override_join_lines_based_on_source ensures that the lines are always printed on
# separate lines rather than being joined, even if join_lines_based_on_source has
# been enabled by the user
add_node!(t, n, s; override_join_lines_based_on_source = true)
end

# we need to maintain the start and endlines of the original source
t.startline = startline
t.endline = endline

t
return t
end

# GlobalRefDoc (docstring)
Expand Down
Loading
Loading