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

Neotest with dap strategy in very large repo causing nvim to freeze #453

Open
dbatten5 opened this issue Sep 11, 2024 · 2 comments
Open
Assignees

Comments

@dbatten5
Copy link

NeoVim Version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478

Describe the bug
Apologies for the vagueness but I'm not really sure how to pinpoint this issue.

I work in a very large monorepo at work. I've previously been able to run neotest DAP with
nvim-dap without any issues to debug the application. Since upgrading neotest to version
that required neotest-nio, whenever I try to run neotest with DAP strategy my neovim freezes
and I end up having to close the tab in my terminal. I can see the neovim process at around 99%
CPU. I'm not sure if this is an issue with neotest or nvim-dap or a combination of the two. I'm also
not sure how to provide any useful information here

Logs
The log file is 1.8m lines long. A huge amount the lines have this form:

DEBUG | 2024-09-11T10:44:26Z+0100 | ...al/share/nvim/lazy/neotest/lua/neotest/lib/file/find.lua:26 | Scanning directory: path/in/monorepo

I can also see that it's scanning through e.g. node_modules that are buried within the monorepo. Is there a config option I can be setting to to make sure I don't scan the entire monorepo here?

My setup looks like this:

    neotest.setup({
      adapters = {
        neotest_python({
          args = { "-vv" },
        }),
      },
      output = { open_on_run = true },
      discovery = {
        enabled = false,
      },
    })
@dbatten5 dbatten5 changed the title Neotest dap causing nvim to freeze Neotest with dap strategy in very large repo causing nvim to freeze Sep 11, 2024
@asmodeus812
Copy link

                                                      *neotest.Config.discovery*
Fields~
{enabled} `(boolean)`
{concurrent} `(integer)` Number of workers to parse files concurrently. 0
automatically assigns number based on CPU. Set to 1 if experiencing lag.
{filter_dir} `(nil)` | fun(name: string, rel_path: string, root: string):
boolean A function to filter directories when searching for test files.
Receives the name, path relative to project root and project root path

Checkout this

@fredrikaverpil
Copy link
Contributor

Already mentioned above, but yes, you can make neotest only query the opened buffer for tests, which likely will help you out here:

{
  "nvim-neotest/neotest",
  opts = {
    -- See all config options with :h neotest.Config
    discovery = {
      -- Drastically improve performance in ginormous projects by
      -- only AST-parsing the currently opened buffer.
      enabled = false,
      -- Number of workers to parse files concurrently.
      -- A value of 0 automatically assigns number based on CPU.
      -- Set to 1 if experiencing lag.
      concurrent = 1,
    },
    running = {
      -- Run tests concurrently when an adapter provides multiple commands to run.
      concurrent = true,
    },
    summary = {
      -- Enable/disable animation of icons.
      animated = false,
    },
  },
}

I feel this kind of info should be more prominently explained in the main README.

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

No branches or pull requests

4 participants