# Setting line length limits in VS Code

**URL:** <https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747>\
**Category:** VS Code\
**Created:** [May 2, 2024, 6:47am UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747 "2024-05-02T06:47:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [May 2, 2024, 6:47am UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/1 "2024-05-02T06:47:18Z")

</div>

Does anyone know how to set a 92 character line length limit or a vertical reference line in VS code?

---

<div class="post-metadata">

**Author:** ![lmshk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmshk/32/29632_2.png) [@lmshk](https://discourse.julialang.org/u/lmshk)\
**Post date:** [May 2, 2024, 11:25am UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/2 "2024-05-02T11:25:43Z")

</div>

See [this answer on Stack Overflow](https://stackoverflow.com/questions/29968499/vertical-rulers-in-visual-studio-code/29972073#29972073) for the vertical reference.

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [May 3, 2024, 2:04am UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/3 "2024-05-03T02:04:00Z")

</div>

Thanks!

But should we really follow the 92 character line length limit? The [BlueStyle](https://github.com/JuliaDiff/BlueStyle?tab=readme-ov-file#documentation) 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.

```julia
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

```

---

<div class="post-metadata">

**Author:** ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)\
**Post date:** [May 9, 2024, 1:46pm UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/4 "2024-05-09T13:46:33Z")

</div>

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`:

```julia
"""
    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

```julia-repl
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.

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [May 9, 2024, 1:52pm UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/5 "2024-05-09T13:52:03Z")

</div>

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. 🥴

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 9, 2024, 1:57pm UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/6 "2024-05-09T13:57:40Z")

</div>

> **[Rewrap - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=stkb.rewrap)**
>
> Extension for Visual Studio Code - Hard word wrapping for comments and other text at a given column.

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [May 9, 2024, 1:59pm UTC](https://discourse.julialang.org/t/setting-line-length-limits-in-vs-code/113747/7 "2024-05-09T13:59:11Z")

</div>

👍 👍 👍
