nvimtools / none-ls.nvim

null-ls.nvim reloaded / Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
The Unlicense
2.39k stars 69 forks source link

Allow per directory configuration override for vale diagnostics #157

Closed ianhomer closed 1 month ago

ianhomer commented 1 month ago

Issues

Feature description

Vale configuration - https://vale.sh/docs/topics/config/ - has a feature where the vale process scans up from the current directory to find the first .vale.ini configuration file in the current directory and any parent directory. It uses this configuration in addition to the global configuration. This allows per directory configuration to be set for vale processing.

The current implementation of the vale builtin for none-ls doesn't have a cwd function set and so falls back to setting cwd for the spawn process to the root directory for the nvim process. Vale in the current builtin implementation looks in that root folder and scans up through parent folders, however this misses the opportunity to do per-directory vale configuration.

Help

Yes - I have created a PR which I think implements this feature, thank you for any comments and thoughts on this.

Implementation help

If we set the cwd for the spawned vale process to the directory of the file being processed then we naturally pick up on the vale configuration from the directories and parent directory of the current file.

I suspect this is simply a matter of defining a cwd function for the vale builtin, e.g.

        cwd = function(params)
            return vim.fn.fnamemodify(params.bufname, ":h")
        end,
mochaaP commented 1 month ago

fixed in #158