# Indentation in Atom/VS Code

**URL:** <https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591>\
**Category:** General Usage\
**Created:** [October 21, 2017, 1:51am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591 "2017-10-21T01:51:18Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 21, 2017, 1:51am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/1 "2017-10-21T01:51:18Z")

</div>

Both of the editors render the following 3 lines, of which 2 are continuation of the first, without any indentation. That is,  
like this:

```julia
fcoarsetransferred = transferfield!(fcoarsetransferred, 
fensfine, regionsfine[i]["femm"].geod.fes, fcoarse,
fcoarse, fenscoarse, regionscoarse[i]["femm"].geod.fes, geometricaltolerance)

```

What I would like of course is

```julia
fcoarsetransferred = transferfield!(fcoarsetransferred, 
        fensfine, regionsfine[i]["femm"].geod.fes, fcoarse,
        fcoarse, fenscoarse, regionscoarse[i]["femm"].geod.fes, geometricaltolerance)

```

Has anyone else had this experience? If so, and if it isn’t just me, are there any fixes?

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 21, 2017, 2:31am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/2 "2017-10-21T02:31:44Z")

</div>

Yes, I also experienced this in atom. Don’t know the solution of how to do it in atom, but in vim you can add this to your `.vimrc` file

```julia
set linebreak breakindent breakindentopt=shift:2

```

where the `shift` parameter determines how far you want to indent.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 21, 2017, 7:25pm UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/3 "2017-10-21T19:25:43Z")

</div>

Thanks, that is good to know. I’ve always liked vim. However, the Atom and VS code editors are really convenient to work with, and I would really like to see the indentation improved.

---

<div class="post-metadata">

**Author:** ![Karsten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karsten/32/565_2.png) [@Karsten](https://discourse.julialang.org/u/Karsten)\
**Post date:** [October 21, 2017, 11:19pm UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/4 "2017-10-21T23:19:57Z")

</div>

In the settings for Atom’s **language-julia** package is a **Soft Wrap** option that is switched off by default. After activating it and setting the **Soft Wrap Hanging Indent** to 8, you get the desired indention:

 ![Juno](https://global.discourse-cdn.com/julialang/original/3X/b/d/bd156e0633c6ffb64b1777414d57d560c57d2911.png)

In VS Code indented wrapping can be activated by adding

```julia
    "editor.wordWrap": "on",
    "editor.wrappingIndent": "indent",

```

to your _User Settings_.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 12:15am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/5 "2017-10-22T00:15:43Z")

</div>

Thanks for your suggestions. I’ve tried so far with VS code, but unsuccessfully: I still get

```julia
        modeldata = FDataDict("fens"=>fens,
        "regions"=>regions,
        "essential_bcs"=>[ex, ey, ez],
        "traction_bcs"=> [Trac]
        )

```

when I do re-indent on this block of code.  
This is what my “user settings” look like. I hope that this is what you had in mind?

```julia
{
    "julia.executablePath": "C:\\Users\\PetrKrysl\\AppData\\Local\\Julia-0.6.0\\bin\\julia.exe",
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "workbench.colorTheme": "Tomorrow Night Blue",
    "julia.runlinter": false,
    "window.zoomLevel": 0,
    // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
    "editor.detectIndentation": false,
    // Controls if the editor should automatically adjust the indentation when users type, paste or move lines. Indentation rules of the language must be available. 
    "editor.autoIndent": true,
    "editor.wordWrap": "on",
    "editor.wrappingIndent": "indent",
}

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 12:32am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/6 "2017-10-22T00:32:33Z")

</div>

Actually, I did not find the soft-wrap setting in the Julia settings. I did find it in the editor settings:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/3/b3f55bfd8b604428473bb4cdbba1442a2e965c08.png)  
Setting it however did not work. Still the same behavior.

I am on 1.21.1, Windows 10.

---

<div class="post-metadata">

**Author:** ![Karsten](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karsten/32/565_2.png) [@Karsten](https://discourse.julialang.org/u/Karsten)\
**Post date:** [October 22, 2017, 12:46am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/7 "2017-10-22T00:46:00Z")

</div>

For Julia files the editor settings are overwritten by the language-julia settings. The following picture shows where they can be found:

 ![language-julia_Settings](https://global.discourse-cdn.com/julialang/original/3X/7/5/7596e6f40c8bc168b2da1e3a0974adc556b15c24.png)

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 12:51am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/8 "2017-10-22T00:51:20Z")

</div>

Okay, found the soft wrap in the language-Julia settings. The settings you suggested are on, still no correct indentation.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [October 22, 2017, 2:28am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/9 "2017-10-22T02:28:26Z")

</div>

Which version of the package do you have installed?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 2:29am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/10 "2017-10-22T02:29:43Z")

</div>

I am on language-Julia 0.12.0…

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 22, 2017, 2:29am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/11 "2017-10-22T02:29:51Z")

</div>

It seems to work fine for me on my end in atom.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 2:30am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/12 "2017-10-22T02:30:21Z")

</div>

I will try to reinstall everything. Oh well…

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [October 22, 2017, 2:31am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/13 "2017-10-22T02:31:31Z")

</div>

Did you enable soft wrap?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 2:32am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/14 "2017-10-22T02:32:48Z")

</div>

Yes, I did. Both for the editor settings and for language-Julia.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 2:48am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/15 "2017-10-22T02:48:30Z")

</div>

Okay. With Atom reinstall from a clean slate the soft wrap works. I will try to install the packages that I used to use to see which one breaks it.

Thanks all for your help. By the way, if you have a solution for VS code please don’t hesitate to let me know.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 22, 2017, 4:59am UTC](https://discourse.julialang.org/t/indentation-in-atom-vs-code/6591/16 "2017-10-22T04:59:13Z")

</div>

With clean install of VS code I can get the soft wrap to work. Thanks!
