Neovim + lsp + formatter (again)

Roughly, the pipeline is like this:


The depend arrow. Upon installing the julials server of nvim-lspconfig as instructed here, one should have a folder

~/.julia/environments/nvim-lspconfig

which looks like

.
├── Manifest.toml
└── Project.toml

and inside Manifest.toml, one can find an entry [[deps.JuliaFormatter]], which means that the language server depends on JuliaFormatter to do the LSP formatting.

So, to configure the formatting of this LSP, rather than controlling the behavior of some NeoVim plugin, one actually needs to configure the behavior of the JuliaFormatter.jl package.


The config arrow. In the docs of JuliaFormatting.jl, there is a section on how to use .JuliaFormatter.toml files to config the package. The project directory needs to have this dotfile and a Project.toml file (the latter is required!).

Note also that, once it sees a Project.toml, JuliaFormatter regards this as the root of its working directory, and stops searching for config files higher on the tree. See this issue, for example, and this post.

1 Like