I couldn't find better place to ask this question.
What tools do you use to edit and more importantly format *.sls files?
In vscode, I could not find a way to re-format code/files, but syntax was highlighted nicely.
I've tried using salt-vim, but it didn't format anything.
I stuck with intellij only because I'm familiar with it, however no formatting nor plugins for Salt works there.
EDIT: I've edited the vscode point
VS Code works well, it has a nice Salt plugin available. Using VIM with salt-vim is a good solution as well, but requires some additional settings and plugins, eg. setting the tabs, etc. @saltstack/team-core thoughts?
VS Code works well, it has a nice Salt plugin available
Am I right? That plugin provides syntax highlighting only?
I just use vim with set shiftwidth=2 tabstop=2 autoindent expandtabs, or set sw=2 ts=2 ai et for short.
@kiemlicz As far as I know, the VSCode SaltStack plugin only provides syntax highlighting, Jinja bracket autocompletion and generic indentation folding (useful for YAML).
You can experiment with the vscode-yaml plugin (it declares some support for YAML formatting), but you'll need to figure out how to make it undestand Salt- and Jinja-specific syntax.
In general, there are two reasons why it is hard to have robust formatting support for SLS files (as compared to JSON for example):
I have a more detailed post on this topic here.
The aforementioned post covers it all
Thank you!
To update anyone finding this later: the saltstack vscode extension was just updated to support autocomplete of state modules for sls files, as well as test entries for saltcheck tst files. Additionally, you should now use the saltstack extension pack to ensure you have both the saltstack syntax and autocomplete plugin as well as the salt-lint plugin (which lints sls files).