# JuliaFormatter whitespace in keyword arguments

**URL:** <https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596>\
**Category:** General Usage\
**Tags:** question, package, vscode\
**Created:** [August 31, 2022, 12:52pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596 "2022-08-31T12:52:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [August 31, 2022, 12:52pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/1 "2022-08-31T12:52:59Z")

</div>

I was using JuliaFormatter through the Julia VSCode extension and I noticed that the default behaviour seems to be to remove the whitespaces.

However, in the README file in [Github](https://github.com/domluna/JuliaFormatter.jl) it says that the default behaviour is to always have whitespaces (and that seems to be the style guide of the SciML organization).

Am I missing something or the default behaviour was changed to remove whitespaces in keyword arguments?

---

<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:** [August 31, 2022, 2:15pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/2 "2022-08-31T14:15:54Z")

</div>

The VS Code extension has different defaults from JuliaFormatter. We’re working towards a more satisfactory solution though.

The SciML config should still take effect when formatting files though.

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [August 31, 2022, 2:24pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/3 "2022-08-31T14:24:29Z")

</div>

Is there any way I can change this specific setting without creating a formatting file for every project? It really does not work as the SciML config at least for this option.

---

<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:** [August 31, 2022, 2:26pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/4 "2022-08-31T14:26:40Z")

</div>

How are you telling the formatter to use the SciML style without a `JuliaFormatter.toml`?

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [August 31, 2022, 2:32pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/5 "2022-08-31T14:32:09Z")

</div>

Oh, I thought that with your previous answers you meant that the default formatting of JuliaFormatter is the SciML one (which also has whitespaces for keyword argument as a default).

I use the JuliaFormatter via specifying in the `setting.json` file the following

```julia
 "[julia]": {
    "editor.defaultFormatter": "julialang.language-julia"
  },

```

---

<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:** [August 31, 2022, 2:36pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/6 "2022-08-31T14:36:01Z")

</div>

That wasn’t what I was trying to get at 🙂  
If you want your code to conform to the SciML style, then you’ll need to tell JuliaFormatter to use that style. Currently, the only way to do that in VS Code is with project-local `.JuliaFormatter.toml` files – global configuration is not currently a thing (by design).

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [August 31, 2022, 2:41pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/7 "2022-08-31T14:41:59Z")

</div>

Thank you for clarifying that, but my question was about the default behaviour.

According to the documentation, even if you do not specify any style, the whitespace in keyword arguments should be present. But, when I use the formatting without specifying any style, the formatter automatically removes the whitespaces.

---

<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:** [August 31, 2022, 2:43pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/8 "2022-08-31T14:43:30Z")

</div>

Yeah. Then we’re back to

> [@pfitzseb](#):
>
> The VS Code extension has different defaults from JuliaFormatter.

To be more specific, these are the VS Code extension’s defaults:

> <https://github.com/julia-vscode/LanguageServer.jl/blob/a7918117ae43f23aa3a79ebddd883943783cf58e/src/requests/features.jl#L145-L151>

---

<div class="post-metadata">

**Author:** ![RayleighLord](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rayleighlord/32/33592_2.png) [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Post date:** [August 31, 2022, 2:49pm UTC](https://discourse.julialang.org/t/juliaformatter-whitespace-in-keyword-arguments/86596/9 "2022-08-31T14:49:47Z")

</div>

Oh sorry, I misread that.

Thank you for sharing the code with the defaults. I guess I will disable the default formatter for small files and use the styles for bigger project until we have a better approach.
