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

Support Conditional Formatting and Extra Arguments #38

Closed
barrett-ruth opened this issue Jul 27, 2023 · 2 comments · Fixed by #163
Closed

Support Conditional Formatting and Extra Arguments #38

barrett-ruth opened this issue Jul 27, 2023 · 2 comments · Fixed by #163

Comments

@barrett-ruth
Copy link
Contributor

In null-ls one can avoid formatting if a certain "condition" is not met like so:

        diagnostics.eslint_d.with({
            condition = function(utils)
                return utils.root_has_file({
                    {
                        '.eslintrc',
                        '.eslintrc.cjs',
                        '.eslintrc.yaml',
                        '.eslintrc.yml',
                        '.eslintrc.json',
                    },
                })
            end,
        }),

One can also pass extra arguments to a source:

        diagnostics.sqlfluff.with({
            extra_args = {
                '--dialect',
                'postgres',
                '--exclude-rules',
                'LT02,LT05',
            },
        }),

I think these are two more relevant features that are important to be implemented, although I think customizability should indeed be kept to a minimum.

@glepnir
Copy link
Member

glepnir commented Jul 28, 2023

I will implement these.

@glepnir
Copy link
Member

glepnir commented Jul 28, 2023

tool now has find field type is string or table of config files . filetype module support extra DSL you can use it like

ft('c'):fmt('clang-format'):extra(argument1, argument2,argument3,...):lint('clang-tidy'):extra(....)

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 a pull request may close this issue.

2 participants