# Comment lines trip up the folding mechanism

**URL:** <https://discourse.julialang.org/t/comment-lines-trip-up-the-folding-mechanism/135792>\
**Category:** VS Code\
**Created:** [February 23, 2026, 4:29pm UTC](https://discourse.julialang.org/t/comment-lines-trip-up-the-folding-mechanism/135792 "2026-02-23T16:29:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryofurue](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ryofurue/32/24531_2.png) [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Post date:** [February 23, 2026, 4:29pm UTC](https://discourse.julialang.org/t/comment-lines-trip-up-the-folding-mechanism/135792/1 "2026-02-23T16:29:50Z")

</div>

For this source code

```julia-auto
module MyModule
function func(x)
# comment line
# another comment line
  for i in 1:10
    for j in 2:9
      println(i+j)
    end
  end
end
end

```

the function cannot be folded. You need to insert spaces in front of the comments to be able to fold the function. I guess that means that the range detection uses indentation, not the language server.

Is this a standard behavior?

I use the official `Julia` extension by julialang. I keep updating VS Code and its extensions.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [February 23, 2026, 4:39pm UTC](https://discourse.julialang.org/t/comment-lines-trip-up-the-folding-mechanism/135792/2 "2026-02-23T16:39:11Z")

</div>

Yes, code folding is currently completely indentation based.
