Does anyone know how to set a 92 character line length limit or a vertical reference line in VS code?
See this answer on Stack Overflow for the vertical reference.
Thanks!
But should we really follow the 92 character line length limit? The BlueStyle suggests that
Docstring lines should be wrapped at 92 characters.
But I found that even the Julia internal functions’ docstrings didn’t follow this rule.
help?> for
search: for foreach FourierMotzkin fourierelimination foldr floor mapfoldr factorial COPT_CBINFO_RELAXSOLOBJ COPT_CBINFO_RELAXSOLUTION COPT_DBLINFO_RELAXUB COPT_DBLINFO_RELAXLB COPT_DBLINFO_REDCOST COPT_DBLINFO_RELAXVALUE
for
for loops repeatedly evaluate a block of statements while iterating over a sequence of values.
The iteration variable is always a new variable, even if a variable of the same name exists in the enclosing scope. Use outer to reuse an existing local variable for iteration.
Examples
≡≡≡≡≡≡≡≡≡≡
julia> for i in [1, 4, 0]
println(i)
end
1
4
0
That’s just printing. I didn’t want to go through the trouble of locating the docstring for a keyword like for
, but here’s the first few lines of the in-code docstring definition for xor
:
"""
xor(x, y)
⊻(x, y)
Bitwise exclusive or of `x` and `y`. Implements
[three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic),
returning [`missing`](@ref) if one of the arguments is `missing`.
The infix operation `a ⊻ b` is a synonym for `xor(a,b)`, and
`⊻` can be typed by tab-completing `\\xor` or `\\veebar` in the Julia REPL.
"""
Which, when printed (when I set my terminal narrow), looks like
help?> xor
search: xor export StringIndexError CanonicalIndexError
xor(x, y)
⊻(x, y)
Bitwise exclusive or of x and y. Implements three-valued
logic (https://en.wikipedia.org/wiki/Three-valued_logic),
returning missing if one of the arguments is missing.
The infix operation a ⊻ b is a synonym for xor(a,b), and ⊻
can be typed by tab-completing \xor or \veebar in the
Julia REPL.
Notice that the line breaks are in different places. While I don’t know the exact rules, single line breaks are usually omited from docstring printing. The printing wraps text in its own way based on the current terminal width.
Well, thanks. But when writing a long docstring, it is really troublesome to manually wrap lines frequently, and it is also inconvenient to copy the text to other places because I have to delete the line feeds again.