JuliaFormatter whitespace in keyword arguments

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 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?

1 Like

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.

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.

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

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]": {
    "editor.defaultFormatter": "julialang.language-julia"
  },

That wasn’t what I was trying to get at :slight_smile:
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).

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.

Yeah. Then we’re back to

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

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.