mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
1.77k stars 191 forks source link

Add swiftlint support #555

Closed wojciech-kulik closed 3 months ago

wojciech-kulik commented 3 months ago

I've been using this configuration for some time, but I decided that it would be nice for others to have it built-in here :)

wojciech-kulik commented 3 months ago

@mfussenegger It looks like tests fail because of vim.fs.find usage on v0.6.1? Any advice on what should I do about it?

mfussenegger commented 3 months ago

@mfussenegger It looks like tests fail because of vim.fs.find usage on v0.6.1? Any advice on what should I do about it?

Could guard the find call. E.g. something like:

local function find_config(filename)
  if vim.fs and vim.fs.find then
    return vim.fs.find(filename, {
        upward = true,
        stop = vim.fs.dirname(vim.loop.os_homedir()),
        path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
    })[1]
  end
  return nil
end

That would limit the config file detection to newer versions, but I'd be fine with that. Linters in nvim-lint generally instead depend on cwd being set correctly instead of having custom config file detection logic

wojciech-kulik commented 3 months ago

Thank you! I fixed that.

mfussenegger commented 3 months ago

Thanks