Skip to content

Refactor/conform#1991

Open
oriori1703 wants to merge 2 commits intomasterfrom
refactor/conform
Open

Refactor/conform#1991
oriori1703 wants to merge 2 commits intomasterfrom
refactor/conform

Conversation

@oriori1703
Copy link
Copy Markdown
Collaborator

@oriori1703 oriori1703 commented Apr 13, 2026

  1. Change format_on_save to a blacklist
  2. Use stylua's lsp for formatting instead of its CLI

fixes #1819

Comment thread init.lua
Comment on lines +700 to +702
default_format_opts = {
lsp_format = 'fallback', -- Use LSP formatting if available, otherwise use external formatters. Set to `false` to disable LSP formatting.
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the theme of this PR is to reduce unexpected formatting on save, I think these lines should be removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah but then the lua formatting will not work. Hmm not sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, that comment is not correct. Fallback means using LSP when no other formatters are available, not prioritizing it.

See conform documentation here

Copy link
Copy Markdown
Collaborator Author

@oriori1703 oriori1703 Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those lines were added just so you don't have to repeat it in 2 places (previously it was in 693 and 674)

@nathanzeng
Copy link
Copy Markdown
Contributor

What is the reason for switching to stylua's LSP instead of its CLI? I think it was more clear when stylua was defined in the formatters_by_ft block.

@SebastianBr11
Copy link
Copy Markdown

I tried using the Stylua LSP for formatting and removing it from formatters_by_ft in the conform settings, I also disabled formatting in the lua_ls settings, but then pressing <leader>f no longer formatted the file. I imagine, Conform tries lua_ls, but it doesn't do anything and stylua is ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

please disable autoformat on save in default configuration

3 participants