Giter VIP home page Giter VIP logo

none-ls.nvim's Introduction

none-ls.nvim

null-ls.nvim Reloaded, maintained by the community.

Only the repo name is changed for compatibility concerns. All the API and future changes will keep in place as-is.

Migration

Replace jose-elias-alvarez/null-ls.nvim with nvimtools/none-ls.nvim in your choice of package manager.

That's it.

Community

Open a pull request to become a collaborator. If you have contributed to null-ls.nvim before, simply open an issue or comment on that commit.

If you want to make changes, open a new a pull request. Find another collaborator to review your changes, as a review is required for the PR to be merged by yourself (subject to change if there are more collaborators in the future).


null-ls.nvim

Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.

Motivation

Neovim's LSP ecosystem is growing, and plugins like telescope.nvim and trouble.nvim make it a joy to work with LSP features like code actions and diagnostics.

Unlike the VS Code and coc.nvim ecosystems, Neovim doesn't provide a way for non-LSP sources to hook into its LSP client. null-ls is an attempt to bridge that gap and simplify the process of creating, sharing, and setting up LSP sources using pure Lua.

null-ls is also an attempt to reduce the boilerplate required to set up general-purpose language servers and improve performance by removing the need for external processes.

Status

null-ls is in beta status. Please see below for steps to follow if something doesn't work the way you expect (or doesn't work at all).

null-ls is developed on and tested against the latest stable version of Neovim. Support for versions built from HEAD is provided on a best-effort basis, and users are encouraged to contribute fixes to any issues exclusive to these versions.

Features

null-ls sources are able to hook into the following LSP features:

  • Code actions

  • Diagnostics (file- and project-level)

  • Formatting (including range formatting)

  • Hover

  • Completion

null-ls includes built-in sources for each of these features to provide out-of-the-box functionality. See BUILTINS for a list of available built-in sources and BUILTIN_CONFIG for instructions on how to set up and configure these sources.

null-ls also provides helpers to streamline the process of spawning and transforming the output of command-line processes into an LSP-friendly format. If you want to create your own source, either for personal use or for a plugin, see HELPERS for details.

Setup

Install null-ls using your favorite package manager. The plugin depends on plenary.nvim, which you are (probably) already using.

To get started, you must set up null-ls and register at least one source. See BUILTINS for a list of available built-in sources and CONFIG for information about setting up and configuring null-ls.

local null_ls = require("null-ls")

null_ls.setup({
    sources = {
        null_ls.builtins.formatting.stylua,
        null_ls.builtins.diagnostics.eslint,
        null_ls.builtins.completion.spell,
    },
})

Documentation

The definitive source for information about null-ls is its documentation, which contains information about how null-ls works, how to set it up, and how to create sources.

Contributing

Contributions to add new features and built-ins for any language are always welcome. See CONTRIBUTING for guidelines.

Examples

Parsing buffer content

The following example demonstrates a diagnostic source that will parse the current buffer's content and show instances of the word really as LSP warnings.

local null_ls = require("null-ls")

local no_really = {
    method = null_ls.methods.DIAGNOSTICS,
    filetypes = { "markdown", "text" },
    generator = {
        fn = function(params)
            local diagnostics = {}
            -- sources have access to a params object
            -- containing info about the current file and editor state
            for i, line in ipairs(params.content) do
                local col, end_col = line:find("really")
                if col and end_col then
                    -- null-ls fills in undefined positions
                    -- and converts source diagnostics into the required format
                    table.insert(diagnostics, {
                        row = i,
                        col = col,
                        end_col = end_col + 1,
                        source = "no-really",
                        message = "Don't use 'really!'",
                        severity = vim.diagnostic.severity.WARN,
                    })
                end
            end
            return diagnostics
        end,
    },
}

null_ls.register(no_really)

Parsing CLI program output

null-ls includes helpers to simplify the process of spawning and capturing the output of CLI programs. This example shows how to pass the content of the current buffer to markdownlint via stdin and convert its output (which it sends to stderr) into LSP diagnostics:

local null_ls = require("null-ls")
local helpers = require("null-ls.helpers")

local markdownlint = {
    method = null_ls.methods.DIAGNOSTICS,
    filetypes = { "markdown" },
    -- null_ls.generator creates an async source
    -- that spawns the command with the given arguments and options
    generator = null_ls.generator({
        command = "markdownlint",
        args = { "--stdin" },
        to_stdin = true,
        from_stderr = true,
        -- choose an output format (raw, json, or line)
        format = "line",
        check_exit_code = function(code, stderr)
            local success = code <= 1

            if not success then
                -- can be noisy for things that run often (e.g. diagnostics), but can
                -- be useful for things that run on demand (e.g. formatting)
                print(stderr)
            end

            return success
        end,
        -- use helpers to parse the output from string matchers,
        -- or parse it manually with a function
        on_output = helpers.diagnostics.from_patterns({
            {
                pattern = [[:(%d+):(%d+) [%w-/]+ (.*)]],
                groups = { "row", "col", "message" },
            },
            {
                pattern = [[:(%d+) [%w-/]+ (.*)]],
                groups = { "row", "message" },
            },
        }),
    }),
}

null_ls.register(markdownlint)

FAQ

Something isn't working! What do I do?

NOTE: If you run into issues when using null-ls, please follow the steps below and do not open an issue on the Neovim repository. null-ls is not an actual LSP server, so we need to determine whether issues are specific to this plugin before sending anything upstream.

  1. Make sure your configuration is in line with the latest version of this document.
  2. Enable debug mode and check the output of your source(s). If the CLI program is not properly configured or is otherwise not running as expected, that's an issue with the program, not null-ls.
  3. Check the documentation for available configuration options that might solve your issue.
  4. If you're having trouble configuring null-ls or want to know how to achieve a specific result, open a discussion.
  5. If you believe the issue is with null-ls itself or you want to request a new feature, open an issue and provide the information requested in the issue template.

My :checkhealth output is wrong! What do I do?

Checking whether a given command is executable is tricky, and null-ls' health check doesn't handle all cases. null-ls' internal command resolution is independent of its health check output, which is for informational purposes.

If you're not sure whether a given command is running as expected, enable debug mode and check your log.

How do I format files?

Use vim.lsp.buf.format(). See :help vim.lsp.buf.format() for usage instructions.

How do I format files on save?

See this wiki page.

How do I stop Neovim from asking me which server I want to use for formatting?

See this wiki page.

How do I view project-level diagnostics?

For a built-in solution, use :lua vim.diagnostic.setqflist(). You can also use a plugin like trouble.nvim.

How do I enable debug mode and get debug output?

  1. Set debug flag to true in your config:

    require("null-ls").setup({
        debug = true,
    })
  2. Use :NullLsLog to open your debug log in the current Neovim instance or :NullLsInfo to get the path to your debug log.

As with LSP logging, debug mode will slow down Neovim. Make sure to disable the option after you've collected the information you're looking for.

Does it work with (other plugin)?

In most cases, yes. null-ls tries to act like an actual LSP server as much as possible, so it should work seamlessly with most LSP-related plugins. If you run into problems, please try to determine which plugin is causing them and open an issue.

This wiki page mentions plugins that require specific configuration options / tweaks to work with null-ls.

How does it work?

Thanks to hard work by @folke, the plugin wraps the mechanism Neovim uses to spawn language servers to start a client entirely in-memory. The client attaches to buffers that match defined sources and receives and responds to requests, document changes, and other events from Neovim.

Will it affect my performance?

More testing is necessary, but since null-ls uses pure Lua and runs entirely in memory without any external processes, in most cases it should run faster than similar solutions. If you notice that performance is worse with null-ls than with an alternative, please open an issue!

I am seeing a formatting timeout error message

This issue occurs when a formatter takes longer than the default timeout value. This is an automatic mechanism and controlled by Neovim. You might want to increase the timeout in your call:

vim.lsp.buf.format({ timeout_ms = 2000 })

Tests

The test suite includes unit and integration tests and depends on plenary.nvim. Run make test in the root of the project to run the suite or FILE=filename_spec.lua make test-file to test an individual file.

To avoid a dependency on any plugin managers, the test suite will set up its plugin runtime under the ./tests directory to always have a plenary version available.

If you run into plenary-related issues while running the tests, make sure you have an up-to-date version of the plugin by clearing that cache with: make clean.

All tests expect to run on the latest release version of Neovim and are not guaranteed to work on versions built from HEAD.

Alternatives

none-ls.nvim's People

Contributors

abzcoding avatar andrewferrier avatar aoswalt avatar aspeddro avatar carrascomj avatar cenk1cenk2 avatar cenobantur avatar danilshvalov avatar eshepelyuk avatar euoia avatar folke avatar furkanzmc avatar iamthefij avatar jose-elias-alvarez avatar kylo252 avatar mochaap avatar mskelton avatar muniftanjim avatar mvllow avatar nawordar avatar observeroftime avatar oncomouse avatar raviqqe avatar sirbrillig avatar sloff avatar ssbanerje avatar syphar avatar tastyep avatar timbedard avatar vuki656 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

none-ls.nvim's Issues

Getting failed to load builtin eslint_d for method diagnostics; please check your config

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Macos Sonoma 14.3.1

Minimal Config

Only this line was added ->> null_ls.builtins.diagnostics.eslint_d

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
  local path_sep = on_windows and "\\" or "/"
  local result = table.concat({ ... }, path_sep)
  return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
  local null_ls = require("null-ls")
  -- add only what you need to reproduce your issue
  null_ls.setup({
    sources = {
      null_ls.builtins.diagnostics.eslint_d
    },
    debug = true,
  })
end

local function load_plugins()
  -- only add other plugins if they are necessary to reproduce the issue
  require("packer").startup({
    {
      "wbthomason/packer.nvim",
      {
        "nvimtools/none-ls.nvim",
        requires = { "nvim-lua/plenary.nvim" },
        config = null_ls_config,
      },
    },
    config = {
      package_root = package_root,
      compile_path = compile_path,
    },
  })
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
  load_plugins()
  require("packer").sync()
else
  load_plugins()
  require("packer").sync()
end


### Steps to Reproduce

- Simply add the `eslint_d` diagnostics in the sources and you will egt the following error:
`failed to load builtin eslint_d for method diagnostics; please check your config`

- Make sure you install eslint_d using `npm install -g eslint_d` or using mason-null-ls

Note: If I use `jose-elias-alvarez/null-ls.nvim` instead then everything works fine, so I am guessing this is a bug


### Reproducibility Check

- [ ] I confirm that my minimal config is based on the `minimal_init.lua` template and that my issue is reproducible by running `nvim --clean -u minimal_init.lua` and following the steps above.

### Expected Behavior

I expect the `eslint_d` diagnostic to be recognized as it does when using `jose-elias-alvarez/null-ls.nvim` 

### Actual Behavior

I get the following error: `failed to load builtin eslint_d for method diagnostics; please check your config`

### Debug Log

[WARN  Fri Mar  1 18:30:41 2024] /Users/itsramiel/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/builtins/init.lua:17: failed to load builtin eslint_d for method diagnostics; please check your config


### Help

Yes, but I don't know how to start. I would need guidance

### Implementation Help

_No response_

### Requirements

- [X] I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

codespell failure

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.10.0-dev-2363+gb76a01055

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Both Windows and Linux

Minimal Config

default LunarVim

Steps to Reproduce

codespell fails when words have special characters in them. i.e: Re**-**arrange

[null-ls] failed to run generator: ...e-ls.nvim/lua/null-ls/builtins/diagnostics/codespell.lua:37: attempt to perform arithmetic on local 'end_col' (a nil value)

I have been using a patch for quite some time. So I thought I should share it ๐Ÿ˜Š

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

Special characters should be escaped.

Actual Behavior

Error when Special characters in words

Debug Log

[null-ls] failed to run generator: ...e-ls.nvim/lua/null-ls/builtins/diagnostics/codespell.lua:37: attempt to perform arithmetic on local 'end_col' (a nil value)

Help

Yes

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Jenkinsfile filetype doesn't work

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.2

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Ubuntu 20.04 x64

Minimal Config

local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
	local path_sep = on_windows and "\\" or "/"
	local result = table.concat({ ... }, path_sep)
	return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
	local null_ls = require("null-ls")
	-- add only what you need to reproduce your issue
	null_ls.setup({
		sources = { null_ls.builtins.diagnostics.npm_groovy_lint, null_ls.builtins.formatting.npm_groovy_lint },
		debug = true,
	})
end

local function load_plugins()
	-- only add other plugins if they are necessary to reproduce the issue
	require("packer").startup({
		{
			"wbthomason/packer.nvim",
			{
				"jose-elias-alvarez/null-ls.nvim",
				requires = { "nvim-lua/plenary.nvim" },
				config = null_ls_config,
			},
		},
		config = {
			package_root = package_root,
			compile_path = compile_path,
		},
	})
end

if vim.fn.isdirectory(install_path) == 0 then
	vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
	load_plugins()
	require("packer").sync()
else
	load_plugins()
	require("packer").sync()
end

Steps to Reproduce

  1. nvim --clean -u minimal_init.lua Jenkinsfile.
  2. Close packer with "q" key.
  3. Type ":NullLsInfo", return key

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

Supported source(s) should list "formatting: npm_groovy_lint" and "diagnostics: npm_groovy_lint".

Actual Behavior

The supported source(s) is empty.

Debug Log

empty

However, nvim --clean -u minimal_init.lua Jenkinsfile.groovy works. I also get this issue when running with foobar.Jenkinsfile.

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Trying to open a file in a non-existing path creates error

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

macOS Ventura 13.6.3

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {},
        debug = true,
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "nvimtools/none-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

local capabilities = vim.lsp.protocol.make_client_capabilities()
local null_ls = require("null-ls")

null_ls.setup({
	sources = {
                null_ls.builtins.diagnostics.cppcheck,
              },
	capabilities = capabilities,
})

Steps to Reproduce

nvim --clean -u minimal_init.lua foo/bar/com.c

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

No error.

Actual Behavior

[null-ls] failed to run generator: ...cal/share/nvim/plugged/none-ls.nvim/lua/null-ls/loop.lua:237: failed to create temp file: ENOENT: no such file or di
rectory: /Users/egger/foo.c

Debug Log

[WARN Mon Jan 22 14:36:31 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:94: failed to run generator: ...site/pack/packer/start/none-ls.nvim/lua/null-ls/loop.lua:237: failed to create temp file: ENOENT: no such file or directory: /Users/egger/.config/nvim/foo/bar/.null-ls_814785_com.c

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Generate a machine readeable list of builtins

Discussed in #71

Originally posted by traxys February 12, 2024
As part of nixvim we generate Nix options for each of the available none-ls sources (see here).

This creates a bit of a mismatch between nixvim users and the none-ls docs, as not all sources are implemented, and we often have many PRs to add the sources that people need.
Would it be possible to generate a list of sources in something like JSON that we would be able to consume to automatically generate our options?

Mypy sends a warning notification when opening a new Python file

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

macOS Sonoma 14.4

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {
                null_ls.builtins.diagnostics.mypy,

				},
        debug = true,
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "nvimtools/none-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

Steps to Reproduce

  1. Install Mypy on your system.
  2. nvim --clean -u minimal_init.lua
  3. Open a new Python file: :e bar.py.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

No warning is displayed.

Actual Behavior

A warning message gets displayed:

[null-ls] failed to run generator: ...m/lazy/none-ls/lua/null-ls/helpers/generator_factory.lua:228: error in generator output: mypy: can't read file '/Users/grzesiek/bar.py': No such file or directory

Debug Log

[TRACE Sat Mar 16 09:43:04 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method shutdown
[TRACE Sat Mar 16 09:43:04 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method exit
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/client.lua:114: starting null-ls client
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:329: spawning command "mypy" at /Users/grzesiek/sandbox with args { "--hide-error-codes", "--hide-error-context", "--no-color-output", "--show-absolute-path", "--show-column-numbers", "--show-error-codes", "--no-error-summary", "--no-pretty", "--shadow-file", "/Users/grzesiek/sandbox/bar.py", "/Users/grzesiek/sandbox/.null-ls_814785_bar.py", "/Users/grzesiek/sandbox/bar.py" }
[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:207: error output: mypy: can't read file '/Users/grzesiek/sandbox/bar.py': No such file or directory

[TRACE Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:208: output: nil
[WARN  Sat Mar 16 09:43:08 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:94: failed to run generator: ...t/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:228: error in generator output: mypy: can't read file '/Users/grzesiek/sandbox/bar.py': No such file or directory

Help

Yes

Implementation Help

Hints for how to change the default Mypy config to work with buffers not backed by files.

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

golangci-lint fixes on save

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

I see there's a golangci-lint diagnostics source that disables fixing the issues.
I tried overriding the arguments to remove the --fix=false, but it looks like the buffer isn't updated unless I trigger a re-read by e.g. changing focus from and to neovim ; which is quite annoying.

Could it be possible to have a "formatting" source that runs with fixes as well as the current diagnostics source?

Help

No

Implementation help

No response

Unable to run prettier

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

NVIM v0.9.4

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

MacOS Sonoma 14.2.1

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    local fix = null_ls.builtins.formatting
    local js = { 'javascript', 'typescript', 'vue' }
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {
          fix.trim_newlines,
          fix.trim_whitespace,
          -- Javascript prettier
          fix.prettierd.with {
            filetypes = js,
            condition = function(u)
              return u.root_has_file('node_modules/.bin/prettier') and not u.root_has_file('.disable-prettier')
            end,
          },

        },
        debug = true,
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "nvimtools/none-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

Steps to Reproduce

open a js file and run the formatter with :lua vim.lsp.buf.format {async=true}

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

File is formatted with prettier

Actual Behavior

error message: [null-ls] failed to run generator: ...ker/start/none-ls.nvim/lua/null-ls/utils/cosmiconfig.lua:25: attempt to call field 'unpack' (a nil value)

Debug Log

[WARN Thu Jan 11 12:41:40 2024] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:94: failed to run generator: ...ker/start/none-ls.nvim/lua/null-ls/utils/cosmiconfig.lua:25: attempt to call field 'unpack' (a nil value)

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Ruff python formatter builtin is outdated & duplicated

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.1

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

macos, linux & windows

Minimal Config

n/a

Steps to Reproduce

configure the ruff linter with builtins.formatting.ruff and try to format. Nothing happens.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

The document should be formatted.

Actual Behavior

The wrong command is executed & the document does not format.

The command that is run is ruff --fix where it should be ruff format.

Debug Log

n/a

Help

Yes

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Synchronous root_dir setting contributes to suboptimal load times

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Implement support for asynchronous root_dir setting.

Right now, it uses synchronous root_pattern and gets executed on FileType events. Since root_pattern uses blocking FS operations, this can add noticable time delays to startup time. It does so on my NFS system, where I need to wait 2-5s during initial start up.

Help

Yes

Implementation help

Guidelines on what kind of interface or breaking changes you would be fine with in order to get it done.

none-ls.nvim doesn't integrate so seamlessly with mason-null-ls.nvim anymore

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

arch

Minimal Config

x

Steps to Reproduce

x

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

x

Actual Behavior

x

Debug Log

x

Help

No

Implementation Help

Loading external builtins in the new way

require("null-ls").register(shellcheck_code_actions)

Suffices for end users, but it's not a good solution for distro maintainers.

Example

  • I ship my distro with shellcheck.
  • The final user decides to open mason and change his linter to a different one.

Result

Both shellcheck and the new installed linter are going to appear as loaded in :LspInfo, as shellcheck is now hardcoded in the config (which was not previously necessary).

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

bash-language-server โ†’ No code actions

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

arch

Minimal Config

x

Steps to Reproduce

x

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

x

Actual Behavior

x

Debug Log

x

Help

No

Implementation Help

As indicated here I've installed shellcheck on mason, as replacement for the built-in the bash-language-server.

What works:

  • Linting โ†’ Works ok: It requires you to install shellcheck.
  • LSP โ†’ Works ok: it requires you to install bash-language-server.
  • Formatting โ†’ Works ok: it requires you to install shfmt.

What doesn't work:

  • Code actions are not available anymore.

More info:
Previously I had code actions working with:

require("null-ls").builtins.code_actions.shellcheck

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

none-ls fails with "failed to spawn command pmd: EACCESS: permission denied" but command is executable

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Ubuntu 23.10

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

vim.filetype = on

vim.filetype.add({
    extension = {
        cls = 'apex',
        apex = 'apex',
        trigger = 'apex',
        soql = 'soql',
        sosl = 'sosl',
    }
})

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {
            null_ls.builtins.diagnostics.pmd.with({
                extra_args = {
                    '--rulesets',
                    '~/.local/bin/pmd/rulesets/apex.xml'
                },
                filetypes = { 'apex' }
            })
        },
        debug = true,
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "jose-elias-alvarez/null-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

Steps to Reproduce

  1. Create pmd.sh (https://pastebin.com/mj1R5YZn)
  2. Add pmd.sh to PATH, and alias pmd command to id
if [ -d $HOME/.local/scripts ]; then
    PATH=$HOME/.local/scripts:$PATH
    [[ ! -f $HOME/.local/scripts/pmd.sh ]] || alias pmd='~/.local/scripts/pmd.sh'
fi
  1. Make pmd.sh executable:
    image
  2. Add an apex class file to a directory (sample: https://pastebin.com/NtYH3Bdn)
  3. Ensure pmd can be run as a command from the command line using the arguments passed by null-ls:
    image
  4. Open the apex class file inside neovim, I get this error:
    image

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

PMD is run for the file and results show up

Actual Behavior

Error message [null-ls] failed to run generator: ...site/pack/packer/start/null-ls.nvim/lua/null-ls/loop.lua:165: failed to spawn command pmd: EACCES: permission denied
is shown

Debug Log

[TRACE Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/client.lua:114: starting null-ls client
[TRACE Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize
[TRACE Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized
[TRACE Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen
[TRACE Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:329: spawning command "pmd" at /home/fede/Programming/Salesforce/trigger-framework with args { "--format", "json", "--dir", "/home/fede/Programming/Salesforce/trigger-framework", "--rulesets", "~/.local/bin/pmd/rulesets/apex.xml" }
[WARN  Tue 13 Feb 2024 23:48:24 -03] /home/fede/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:94: failed to run generator: ....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/loop.lua:165: failed to spawn command pmd: EACCES: permission denied

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Auto formatting not working for svelte files on save

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.4

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

macOs sonoma

Minimal Config

null_ls.setup({
  sources = {
    formatting.prettier,
    formatting.stylua,
    diagnostics.eslint_d,
  },
  -- configure format on save
  on_attach = function(current_client, bufnr)
    if current_client.supports_method("textDocument/formatting") then
      vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
      vim.api.nvim_create_autocmd("BufWritePre", {
        group = augroup,
        buffer = bufnr,
        callback = function()
          vim.lsp.buf.format({
            filter = function(client)
              -- only use null-ls for formatting instead of lsp server
              return client.name == "null-ls"
            end,
            bufnr = bufnr,
          })
        end,
      })
    end
  end,
})

Steps to Reproduce

Create a .svelte file and try saving for auto formatting.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

Files should get formatted automatically before write changes.

Actual Behavior

Auto formatting doesn't work.

Debug Log

none.

Help

Yes

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Stylua Tab Formatting

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.10.0-dev

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Ubuntu

Minimal Config

builtins.formatting.stylua

Steps to Reproduce

Attempt to format this code

M = {}

function M.find_duplicates(table1, table2)
    for _, v in pairs(table1) do
        for _, v2 in pairs(table2) do
            if
                M.sanitise_modifier_keys(v.prop1)
                    == M.sanitise_modifier_keys(v2.prop1)
                and v.prop2 ~= v2.prop2
            then
                return true
            end
        end
    end
end

return M
column_width = 80
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"

the if statement indenting on line 7 is missing a tab

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

to be formatted

                    == M.sanitise_modifier_keys(v2.prop1)

Actual Behavior

Formatted

                == M.sanitise_modifier_keys(v2.prop1)

Debug Log

[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method textDocument/formatting
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_FORMATTING
[DEBUG Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:329: spawning command "stylua" at /home/tris/code/hawtkeys.nvim with args { "--search-parent-directories", "--stdin-filepath", "/tmp/random.lua", "-" }
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:207: error output: nil
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/helpers/generator_factory.lua:208: output: M = {}

function M.find_duplicates(table1, table2)
    for _, v in pairs(table1) do
        for _, v2 in pairs(table2) do
            if
                M.sanitise_modifier_keys(v.prop1)
                    == M.sanitise_modifier_keys(v2.prop1)
                and v.prop2 ~= v2.prop2
            then
                return true
            end
        end
    end
end

return M

[DEBUG Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/formatting.lua:89: received edits from generators
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/formatting.lua:90: {
  newText = "    ",
  range = {
    ["end"] = {
      character = 16,
      line = 7
    },
    start = {
      character = 16,
      line = 7
    }
  },
  rangeLength = 0
}
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG Fri 05 Jan 2024 20:41:14 GMT] /home/tris/.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/generators.lua:24: no generators available

Help

Yes

Implementation Help

I am not sure if this is a none-ls bug, or a upstream nvim bug to do with writing the text back into the buffer

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Add line ranges to black for python

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Black has recently been updated to allow for line ranges instead of just whole files ( see their docs )

none-ls should implement passing the --line-ranges argument and also allow black to be called for range formatting (add range formatting to methods)

Help

Yes

Implementation help

No response

Bug: None-ls clients not loading anymore after the recent commits

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.5

Dev Version?

  • [ X] I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

arch

Minimal Config

x

Steps to Reproduce

x

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

x

Actual Behavior

x

Debug Log

x

Help

No

Implementation Help

After the commit 92a0251 my previous config has stopped to work.

    opts = function()
      local nls = require "null-ls"
      return {
        sources = {
          -- You can customize your formatters here.
          nls.builtins.formatting.beautysh.with {
            command = "beautysh",
            args = { "--indent-size=2", "$FILENAME" },
          },
          -- TODO: Disable the next feature once this has been merged.
          -- https://github.com/bash-lsp/bash-language-server/issues/933
          nls.builtins.code_actions.shellcheck,
          nls.builtins.diagnostics.shellcheck.with { diagnostics_format = "" },
        },
        on_attach = utils_lsp.apply_user_lsp_settings,
      }

What's the new way to do this?

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Formatting with the ruff linter (should not be confused with their formatter) is broken

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.4

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Pop!_OS

Minimal Config

local present, null_ls = pcall(require, "null-ls")

if not present then
  return
end

local b = null_ls.builtins

local sources = {
  -- Python
  b.diagnostics.ruff,
  b.formatting.ruff,
  b.formatting.ruff_format,
  b.diagnostics.mypy,
}

null_ls.setup {
  debug = true,
  sources = sources,
}

Steps to Reproduce

I am using the NvChad preconfig and the minimal config is among my custom configs, and I have the latest version of ruff and the latest version of none-ls installed.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

File before:

from functools import partial
from time import monotonic
from enum import Enum, auto
from uuid import UUID
import sys, os, re

def main() -> None:
    pass

if __name__ == "__main__":
    main()

What it should look like after:

import re
import sys
from enum import Enum, auto
from functools import partial
from time import monotonic
from typing import Any
from uuid import UUID


def main() -> None:
    pass

if __name__ == "__main__":
    main()

Actual Behavior

This is what actually happens:

sorting_stuff_2.py:1:20: F401 `typing.Any` imported but unused
sorting_stuff_2.py:2:23: F401 `functools.partial` imported but unused
sorting_stuff_2.py:3:18: F401 `time.monotonic` imported but unused
sorting_stuff_2.py:4:18: F401 `enum.Enum` imported but unused
sorting_stuff_2.py:4:24: F401 `enum.auto` imported but unused
sorting_stuff_2.py:5:18: F401 `uuid.UUID` imported but unused
sorting_stuff_2.py:6:1: E401 Multiple imports on one line
sorting_stuff_2.py:6:8: F401 `sys` imported but unused
sorting_stuff_2.py:6:13: F401 `os` imported but unused
sorting_stuff_2.py:6:17: F401 `re` imported but unused
Found 11 errors.
[*] 1 fixable with the `--fix` option.

Debug Log

The null-ls.log file is 6003 lines long, so I think I'll skip pasting it here.

Help

Yes

Implementation Help

Reverting ALL of the changes made by this pull request should solve this issue. Also, see this issue.

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

pmd v7 not supported

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

pmd version7 code analyzer now switches to use "pmd check" as the main command instead of "pmd", thus null-ls throws a "not recognized parameter" error.
Adding "check" into the extra_args table doesn't work.

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

I locate the cmd is constructed here:

generator_opts.dynamic_command = function(params)

but not sure how to change from "pmd" to "pmd check"

Ruff is not showing up in auto generated builtin docs

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

N/A

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Mac

Minimal Config

N/A

Steps to Reproduce

There is no ruff documentation in the BUILTINS.md file even though there it appears to have been added here.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

I looked at BUILTINS.md to see if ruff was supported as a formatter, but I could not find any documentation. A quick code search only brought up the PR in which it is added. I think ruff should be added by the documentation generation script.

Actual Behavior

ruff does not appear in BUILTINS.md

Debug Log

N/A

Help

Yes

Implementation Help

My assumption is that something is wrong with the doc generation action and script which is causing ruff not to be added to this doc. If someone can confirm this is the issue and has a suspicion as to why I would be willing to look into implementing a fix.

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Deprecating builtins with unmaintained upstream or native LSP replacement

Related projects:


I'm thinking of cleaning up some builtins with the following criteria:

  • Unmaintained (> 1y) or deprecated by upstream with better and widely adopted replacement available (e.g. JSHint, Luacheck)
  • Fully overlapped feature (markdownlint, markdownlint-cli2, mdl)
  • Native LSP available (e.g. ESLint, Biome, Taplo, tsc)

Planned to remove (will keep updating):
edit history โ†’ #58 (comment)

	deleted:    code_actions/eslint.lua        (use eslint-language-server / available in none-ls-extras.nvim)
	deleted:    code_actions/eslint_d.lua      (use eslint-language-server / available in none-ls-extras.nvim)
	deleted:    code_actions/ltrs.lua          (use ltex-ls)
	deleted:    code_actions/shellcheck.lua    (use bashls / available in gbprod/none-ls-shellcheck.nvim)
	deleted:    code_actions/xo.lua            (use eslint-language-server)
	deleted:    diagnostics/bandit.lua         (use ruff)
	deleted:    diagnostics/chktex.lua         (use texlab)
	deleted:    diagnostics/clang_check.lua    (use clangd)
	deleted:    diagnostics/cpplint.lua        (use clangd / available in none-ls-extras.nvim)
	deleted:    diagnostics/curlylint.lua
	deleted:    diagnostics/deno_lint.lua      (use deno lsp)
	deleted:    diagnostics/eslint.lua         (use eslint-language-server)
	deleted:    diagnostics/eslint_d.lua       (use eslint-language-server)
	deleted:    diagnostics/flake8.lua         (use ruff / available in none-ls-extras.nvim)
	deleted:    diagnostics/gospel.lua
	deleted:    diagnostics/jshint.lua         (use eslint-language-server)
	deleted:    diagnostics/jsonlint.lua       (use jsonls)
	deleted:    diagnostics/luacheck.lua       (use selene / available in gbprod/none-ls-luacheck.nvim)
	deleted:    diagnostics/misspell.lua
	deleted:    diagnostics/php.lua            (available in gbprod/none-ls-php.nvim)
	deleted:    diagnostics/protoc_gen_lint.lua (use buf)
	deleted:    diagnostics/puglint.lua
	deleted:    diagnostics/psalm.lua          (use psalm lsp / available in gbprod/none-ls-psalm.nvim)
	deleted:    diagnostics/puppet_lint.lua
	deleted:    diagnostics/pycodestyle.lua    (use ruff)
	deleted:    diagnostics/pydocstyle.lua     (use ruff)
	deleted:    diagnostics/pylama.lua         (use ruff)
	deleted:    diagnostics/pyproject_flake8.lua (use ruff)
	deleted:    diagnostics/ruff.lua           (use ruff lsp)
	deleted:    diagnostics/semistandardjs.lua (use eslint-language-server)
	deleted:    diagnostics/shellcheck.lua     (use bashls / available in gbprod/none-ls-shellcheck.nvim)
	deleted:    diagnostics/standardjs.lua     (use eslint-language-server)
	deleted:    diagnostics/standardrb.lua     (use standardrb lsp)
	deleted:    diagnostics/tsc.lua            (use tsserver)
	deleted:    diagnostics/typos.lua          (use typos-lsp)
	deleted:    diagnostics/vulture.lua        (use ruff)
	deleted:    diagnostics/xo.lua             (use eslint-language-server)
	deleted:    formatting/autoflake.lua       (use ruff)
	deleted:    formatting/autopep8.lua        (use ruff)
	deleted:    formatting/beautysh.lua        (use shfmt)
	deleted:    formatting/brittany.lua        (use haskell-language-server)
	deleted:    formatting/cabal_fmt.lua       (use haskell-language-server)
	deleted:    formatting/deno_fmt.lua        (use deno lsp)
	deleted:    formatting/docformatter.lua    (use ruff)
	deleted:    formatting/dprint.lua          (use dprint lsp)
	deleted:    formatting/dtsfmt.lua          (upstream is missing)
	deleted:    formatting/eslint.lua          (use eslint-language-server)
	deleted:    formatting/eslint_d.lua        (use eslint-language-server)
	deleted:    formatting/fixjson.lua         (use jsonls)
	deleted:    formatting/fourmolu.lua        (use haskell-language-server)
	deleted:    formatting/htmlbeautifier.lua  (use tidy)
	deleted:    formatting/jq.lua              (use jsonls)
	deleted:    formatting/json_tool.lua       (use jsonls)
	deleted:    formatting/jsonnetfmt.lua      (use jsonnet-language-server)
	deleted:    formatting/latexindent.lua     (use texlab / available in none-ls-extras.nvim)
	deleted:    formatting/lua_format.lua      (use stylua)
	deleted:    formatting/markdown_toc.lua    (use marksman)
	deleted:    formatting/perlimports.lua     (use PerlNavigator)
	deleted:    formatting/perltidy.lua        (use PerlNavigator)
	deleted:    formatting/puppet_lint.lua
	deleted:    formatting/pyflyby.lua         (use ruff)
	deleted:    formatting/reorder_python_imports.lua (use ruff, isort or usort)
	deleted:    formatting/ruff.lua            (use ruff lsp)
	deleted:    formatting/ruff_format.lua     (use ruff lsp)
	deleted:    formatting/rustfmt.lua         (use rust-analyzer)
	deleted:    formatting/semistandardjs.lua  (use eslint-language-server)
	deleted:    formatting/standardjs.lua      (use eslint-language-server)
	deleted:    formatting/standardrb.lua      (use standardrb lsp)
	deleted:    formatting/standardts.lua      (use eslint-language-server)
	deleted:    formatting/stylish_haskell.lua (use haskell-language-server)
	deleted:    formatting/taplo.lua           (use taplo lsp)
	deleted:    formatting/templ.lua           (use templ lsp)
	deleted:    formatting/terrafmt.lua
	deleted:    formatting/trim_newlines.lua   (use editorconfig)
	deleted:    formatting/trim_whitespace.lua (use editorconfig)
	deleted:    formatting/vfmt.lua            (use vls)
	deleted:    formatting/xmlformat.lua       (use lemminx)
	deleted:    formatting/xmllint.lua         (use lemminx)
	deleted:    formatting/xq.lua              (use lemminx)
	deleted:    formatting/yq.lua              (use yamlls)
	deleted:    formatting/zigfmt.lua          (use zls)

on_attach doesn't get run if one of the configs throws an error

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

v0.9.5

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

OSX

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")
local function join_paths(...)
	local path_sep = on_windows and "\\" or "/"
	local result = table.concat({ ... }, path_sep)
	return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
	local null_ls = require("null-ls")
	-- add only what you need to reproduce your issue
	null_ls.setup({
		sources = {
			null_ls.builtins.diagnostics.eslint_d,
			null_ls.builtins.formatting.gofmt,
		},
		debug = true,
	})
end

local function load_plugins()
	-- only add other plugins if they are necessary to reproduce the issue
	require("packer").startup({
		{
			"wbthomason/packer.nvim",
			{
				"nvimtools/none-ls.nvim",
				requires = { "nvim-lua/plenary.nvim" },
				config = null_ls_config,
			},
		},
		config = {
			package_root = package_root,
			compile_path = compile_path,
		},
	})
end

if vim.fn.isdirectory(install_path) == 0 then
	vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
	load_plugins()
	require("packer").sync()
else
	load_plugins()
	require("packer").sync()
end

Steps to Reproduce

  1. Open a .go file

That's it. The on_attach won't get run, and more importantly doing :NullLsInfo will yield no sources attached, even though gofmt should be attached.

Now, you can try deleting the eslint_d source, and then it'll work fine.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

Gofmt should work in go files and on_attach should be run, regardless of whether one of the sources throws an error.

Actual Behavior

I get the following error in the console: [null-ls] failed to load builtin eslint_d for method diagnostics; please check your config
And no sources are loaded

Debug Log

[WARN  Tue Mar  5 16:51:14 2024] /Users/ahmed/.local/share/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/builtins/init.lua:17: failed to load builtin eslint_d for method diagnostics; please check your config

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Crash upon making diagnostics with column index out of range

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.4

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

Macos

Minimal Config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue
    null_ls.setup({
        sources = {null_ls.builtins.diagnostics.ruff}
    })
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "nvimtools/none-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

Steps to Reproduce

  1. Open an empty python file with neovim using the minimal_init.lua provided:
nvim --clean -u minimal_init.lua a.py
  1. Write a syntax error like the following one:
if
  1. Exit insert mode

The crash should occur at step 3
The message can be seen using the neovim command :messages

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

No crash and display syntax error

Actual Behavior

Crash of none-ls and it does not restart until neovim is restarted.
It will keep crashing till the syntax error is fine

Debug Log

[WARN Fri Dec 22 19:08:49 2023] /tmp/nvim/site/pack/packer/start/none-ls.nvim/lua/null-ls/generators.lua:94: failed to run generator: ...r/start/none-ls.nvim/lua/null-ls/helpers/diagnostics.lua:71: index out of range

Help

No

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Severe performance degradation

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

0.9.4

Dev Version?

  • I am using a stable Neovim release version, or if I am using a dev version of Neovim I have confirmed that my issue is reproducible on a stable version.

Operating System

MacOs

Minimal Config

Default config, without any changes.

Steps to Reproduce

This is something that i have observed recently, i am mostly using null-ls to attach custom code actions through the generator api. And have just two formatters installed (active at most, stylua and clang format), besides a couple of formatters. However, recently on my trashy m1 at work i started noticing severe performance hits with two very hot paths - didChange and autocompletion. Whenever the internal neovim lsp client would trigger the text change notify event, to notify the server of the changes in the buffer, and whenever the autocompletion engine (nvim-cmp in my case) would request candidates i noticed a severe lag while having null-ls enabled. Went in and disabled it in my config, and after that the issue completely vanished.

The issue is very reproducible when we do changes in the buffer with a macro, say pasting over a word is what i mostly experimented with, over a few lines (dozen) in a buffer that is no bigger than 200 lines, the macro would be extremely laggy and slow, as far as completion goes, the moment you go into insert mode and start typing there is a significant lag / delay once i reach the minimal keyword count i have configured for nvim-cmp (which is 3 at the moment).

I tried disabling the primary language servers i tested with (lua and jdtls) and the issue persisted, only when i killed null-ls would i actually see sane performance, no stuttering, etc

Something to note, i increased the debounce which would help will avoiding the didChange spam , to something like 2seconds, and that fixed the issue while editing in normal mode, but nvim-cmp would still chug and stutter.

Reproducibility Check

  • I confirm that my minimal config is based on the minimal_init.lua template and that my issue is reproducible by running nvim --clean -u minimal_init.lua and following the steps above.

Expected Behavior

No perceived lag, especially when there are no configured formatters or linters at all.

Actual Behavior

Severe drop in performance during the two most hot paths, which modifying the buffer and while auto completing.

Debug Log

None

Help

Yes, but I don't know how to start. I would need guidance

Implementation Help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

regression(test): diagnostics handler handler changedtick tracking should call handler only once if buffer changed in between callbacks

Fail	||	diagnostics handler handler changedtick tracking should call handler only once if buffer changed in between callbacks	
            test/spec/diagnostics_spec.lua:126: Expected to be called 1 time(s), but was called 2 time(s)
            
            stack traceback:
            	test/spec/diagnostics_spec.lua:126: in function <test/spec/diagnostics_spec.lua:116>

Minimal repro:

make test-file FILE=test/spec/diagnostics_spec.lua

Seems a plenary / nvim update broke the async generator

Restart / Auto restart

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

null-ls has a issue about that:

Sometimes, when i pull on the project, some libraries installed are different, and the rubocop (diagnostic) stop working. Because of that, the diagnostic just stop working until i restart the neovim.

Would be awesome to have a :NullRestart or have some auto-restart on the diagnostic

Help

No

Implementation help

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.