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

feat(options): cwd as function with nil for abort #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gjeusel
Copy link

@gjeusel gjeusel commented Nov 11, 2022

Hello back ! Following the issue, the solution I came with.
Allowing to pass a function as the cwd, and when the function returns a nil, it should not trigger the rg run.

It can be used as follow:

require("cmp").setup({
  sources = {
    {
      name = "rg",
      options = {
        cwd = find_root_dir,  -- use rg only if find git in parent dir
      },
    },
  }
}

@lukas-reineke
Copy link
Owner

Thank you,

I still prefer this to be in cmp directly, like discussed in #27, but this might be a good workaround for the time being. 🤔
Let me think about this a bit.

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

Successfully merging this pull request may close these issues.

2 participants