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

[Feature request] support ftplugin #354

Open
mrcjkb opened this issue Jan 28, 2024 · 2 comments
Open

[Feature request] support ftplugin #354

mrcjkb opened this issue Jan 28, 2024 · 2 comments

Comments

@mrcjkb
Copy link
Contributor

mrcjkb commented Jan 28, 2024

Hey 👋

I was wondering if it would be feasible to support ftplugin workflows.
Specifically, I'd like to be able to add adapters to neotest using files in, e.g.

  • ftplugin/haskell.lua
  • ftplugin/rust.lua
  • ftplugin/java.lua

etc.

At a first glance, it looks like, this could easily be achieved by changing

user_config = vim.tbl_deep_extend("force", default_config, config)

to

user_config = vim.tbl_deep_extend("force", user_config or default_config, config)

Taking this a step further, adapters could potentially self-register themselves in an ftplugin script, if the file that triggered the script to be sourced is a test file.

The caveat to the above approach is that vim.tbl_deep_extend doesn't merge lists,
so the user_config.adapters list would be overwritten.
This could be mitigated either by inserting into the existing table, or by providing a separate register_adapter API.

@rcarriga what are your thoughts?

@rcarriga
Copy link
Collaborator

Running setup again introduces complexities elsewhere but I think having a register_adapter method makes sense 😄

@disrupted
Copy link

As a workaround I am inserting directly into the adapters list which seems to work fine. #428 (comment)

But I would also be happy if a public API existed to register adapters on demand.

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

3 participants