Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fantomas Integration #13

Closed
cannorin opened this issue Oct 8, 2019 · 19 comments
Closed

Fantomas Integration #13

cannorin opened this issue Oct 8, 2019 · 19 comments
Assignees
Labels
enhancement New feature or request priority: high This is preferably to be implemented/solved first.

Comments

@cannorin
Copy link
Member

cannorin commented Oct 8, 2019

No description provided.

@cannorin cannorin added the enhancement New feature or request label Oct 8, 2019
@cannorin cannorin self-assigned this Oct 8, 2019
@Krzysztof-Cieslak
Copy link
Member

Krzysztof-Cieslak commented Oct 9, 2019

This is handled as part of LSP, shouldn’t you get it for free?

@cannorin
Copy link
Member Author

cannorin commented Oct 9, 2019

That's the point, I must try it out first.

@cannorin
Copy link
Member Author

OK, formatting works out of the box through LSP, but we should be able to configure it through settings so some work would be needed

@cannorin
Copy link
Member Author

It seems I have to set initializationOptions and LanguageClient-neovim can only specify JSON files to use as the parameter, but workspace/didChangeConfiguration can be used to do runtime configuration. I'll address it as a generic configuration support.

@cannorin
Copy link
Member Author

Ah fsprojects/fantomas#354

@cannorin cannorin added the priority: await This depends on the development of something outside the project. label Nov 6, 2019
@cannorin cannorin added priority: high This is preferably to be implemented/solved first. and removed priority: await This depends on the development of something outside the project. labels Feb 5, 2020
@Krzysztof-Cieslak
Copy link
Member

Reading config is done on the FSAC side.

@cannorin
Copy link
Member Author

cannorin commented Feb 6, 2020

So we don't have to modify the client, right?

@cannorin
Copy link
Member Author

cannorin commented Apr 3, 2020

Actually no change was required (sorry for being late!)

@cannorin cannorin closed this as completed Apr 3, 2020
@kumkee
Copy link

kumkee commented Apr 2, 2023

https://github.com/fsprojects/fantomas/blob/master/docs/Documentation.md#--config-path-to-file-or-folder

The link is broken.
I don't know how to configure the integration and your documentation doesn't mention the details either. Please reopen this issue.

@cannorin
Copy link
Member Author

cannorin commented Apr 4, 2023

@kumkee Please see here: https://fsprojects.github.io/fantomas/docs/index.html

Once you have installed and configured Fantomas, FSAC should use Fantomas as the formatter.

(Currently, #66 is affecting Ionide-vim and it won't work with the latest FSAC, so please allow me to take some time to get everything ready to work for you.)

@kumkee
Copy link

kumkee commented Apr 4, 2023

(Currently, #66 is affecting Ionide-vim and it won't work with the latest FSAC, so please allow me to take some time to get everything ready to work for you.)

Then which is the latest version of FSAC that works with Ionide-vim?

Thank you, @cannorin.

@cannorin
Copy link
Member Author

cannorin commented Apr 4, 2023

@kumkee v0.58.0 is working for me. v0.58.{1,2,3,4} might also work, but I haven't tested.

@kumkee
Copy link

kumkee commented Apr 4, 2023

@kumkee v0.58.0 is working for me. v0.58.{1,2,3,4} might also work, but I haven't tested.

What version of fantomas are you using? I've tried FSAC v0.58.0 with fantomas v 5.1.5. Formatting doesn't work.
For your information, my nvchad config for formatting keys is <space> + fm.

@cannorin
Copy link
Member Author

cannorin commented Apr 4, 2023

@kumkee I'm not very familiar with nvchad, but make sure that <space> + fm is indeed calling LSP's format command (like vim.lsp.buf.format). If you don't see any kind of LSP-related error message, there is a good chance that the format command is not called at all.

@kumkee
Copy link

kumkee commented Apr 4, 2023

If you don't see any kind of LSP-related error message, there is a good chance that the format command is not called at all.

What if the same key combo works in all other languages?

@cannorin
Copy link
Member Author

cannorin commented Apr 4, 2023

It seems that you are using null-ls for formatting and it doesn't contain Fantomas?

https://github.com/kumkee/nvchad_config/blob/main/configs/null-ls.lua#L7C24-L34

@kumkee
Copy link

kumkee commented Apr 4, 2023

It seems that you are using null-ls for formatting and it doesn't contain Fantomas?

https://github.com/kumkee/nvchad_config/blob/main/configs/null-ls.lua#L7C24-L34

It's funny that you asked. I've opened a feature request issue in null-ls. No one has responded. Please have a look.

@cannorin
Copy link
Member Author

cannorin commented Apr 4, 2023

Since Ionide-vim delegates all the LSP functionalities (including formatting) to FSAC (and thus Fantomas), I guess Ionide-vim cannot help you solving the problem.

I think you can either

  1. configure nvim-lspconfig to call the format command (as in https://github.com/neovim/nvim-lspconfig#suggested-configuration), or
  2. try to make null-ls work with Fantomas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: high This is preferably to be implemented/solved first.
Projects
None yet
Development

No branches or pull requests

3 participants