-
Notifications
You must be signed in to change notification settings - Fork 186
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
bug: incorrect range formatting with stylua #89
Comments
Side note comment: I modify/extender my linter arguments with: -- Formatter args
local utils = require('conform.util')
---- Json
utils.add_formatter_args(require('conform.formatters.jq'), { '--indent', '4' })
---- Lua
utils.add_formatter_args(
require('conform.formatters.stylua'),
{ '--config-path=' .. vim.env.HOME .. '/.config/stylua.toml' }
)
---- Python
utils.add_formatter_args(
require('conform.formatters.isort'),
{ '--settings-file=' .. vim.env.HOME .. '/.isort.cfg' }
) I was wondering whether it was possible to define something like local formatters = require('conform.formatters')
utils.add_formatter_args(formatters.jq, { '--indent', '4' }) but I get
Any pointers? (sorry for not opening a new issue about this) |
This is just how stylua works. From the readme:
You can verify this yourself by running the stylua command directly in the terminal and viewing the output. As for your second question, I added a helper so that you can do |
Thank you! |
Hi! I saw that you just added the local formatters = require('conform.formatters')
formatters.jq.args = { '--indent', '4' }
require('conform').formatters.stylua =
{ prepend_args = { '--config-path=' .. vim.env.HOME .. '/.config/stylua.toml' } } Is it possible to add the same helper/metatable-magic so as to rewrite the second line as: formatters.stylua.prepend_args =
{ '--config-path=' .. vim.env.HOME .. '/.config/stylua.toml' } Thanks in advance |
As an alternate proposal, what about local conform = require("conform")
conform.formatters.jq = {
args = { '--indent', '4' }
}
conform.formatters.stylua = {
prepend_args = { '--config-path=' .. vim.env.HOME .. '/.config/stylua.toml' }
} |
Make sense! Thanks |
Neovim version (nvim -v)
NVIM v0.10.0-dev-1240+g9afbfb4d64
Operating system/version
Arch Linux
Output of :ConformInfo
Describe the bug
Range formatting doesn't seem to work properly (at least with stylua)
Steps To Reproduce
,fc
Expected Behavior
After 4. get proper formatting (spaces around equal sign) for visually selected lines.
Minimal example file
No response
Minimal init.lua
Additional context
The text was updated successfully, but these errors were encountered: