How to configure the Formatter? #357
-
Hello, I'm brand new to the D lang - first of all I'd like to extends my thanks for providing us with such lovely free software. My question revolves around the formatter that comes packaged with this LSP. I'm using NeoVim and have just installed this LSP, with the following (default) setup: require'lspconfig'.serve_d.setup{} I also made sure to add both I saw that the dftm allows me to configure such things - but can't figure out the way to pass such information over through the LSP. Is there some sort of config option I can set on Furthermore - is there I way I can set it up without having a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
this depends on your LSP client and how you can pass configuration to it. Basically serve-d takes the project configuration and in there there are options to configure with dfmt. The available settings as D struct: Lines 119 to 135 in 1a26dcd or as JSON schema: https://github.com/Pure-D/code-d/blob/b19258b82d40b72ac4e60497214de14a4248d4d8/package.json#L763 Line endings, indentation size and style (tabs/spaces) should be synced with your standard editor configuration. So if the editor inserts tabs/spaces, the auto-formatting should use the same. (otherwise it might be a NeoVim LSP bug) You will have to consult the NeoVim LSP documentation to see how to set the configuration values. If you find a way, feel free to submit a PR to the |
Beta Was this translation helpful? Give feedback.
Ahhh! I see.
With your suggestions I was able to solve the braces issue like so:
I'd be glad to make a PR to the editor-vim.md; I just need a few pointers.
My nitpick is discoverability - if I type
DFmt
as the types file suggests then it doesn't work - it has to be written in the same style as thepackage.json
That's fair enough, but it feels weird to me to tell the reader "read the package.json of a separate git repo to see how you can tweak serve-d".
I see that that's how it's setup in the main README but I was wondering if there was a be…