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

Telescope is confused about (Javascript) repository root #4511

Closed
githorse opened this issue Feb 26, 2024 · 4 comments
Closed

Telescope is confused about (Javascript) repository root #4511

githorse opened this issue Feb 26, 2024 · 4 comments
Labels
bug Something isn't working stale

Comments

@githorse
Copy link

githorse commented Feb 26, 2024

Problem description

Just installed LunarVim. I have a Javascript/Typescript repository with a number of packages:

my-project/
  packages/
    packageA/
      src/
        FileIAmLookingAt.js
    packageB/
    packageC/
      src/
        FileIAmLookingFor.js
  1. When I use the file finder (<leader>f), Telescope searches my entire repository (which is what I want), but the results falsely claim to be in the same package as the current file. For instance, If I'm looking at fileIAmLookingAt.js and I search for LookingFor, the Telescope match says: ../src/FileIAmLookingFor.js instead of ../../packageC/src/FileIAmLookingFor.js.

  2. When I do a string search (<leader>st), Telescope only searches within the current package (i.e. the package of the file in the current buffer). I get no hits outside of the current package. (There's no issue with reporting the relative path correctly.)

I expected:

  1. Both searches to take place at the repository root.
  2. The file displayed paths to be relative to the current buffer (or, possibly, absolute from the root).

I didn't have either issue with my previous Telescope implementation (but I don't recall any details on setting that up). I'm sure I'm doing something wrong here -- any guidance is welcome!

LunarVim version

release-1.3/neovim-0.9-d1c1bace

Neovim version (>= 0.9.1)

0.9.5

Terminal name

Terminal (MacOS)

Operating system/version

macOS 14.2 (23C64)

Steps to reproduce

See above.

Screenshots

No response

@githorse githorse added the bug Something isn't working label Feb 26, 2024
@githorse
Copy link
Author

I'm guessing that this is because my cwd is getting set to the (Javascript) package of the current file whenever I switch buffers. This doesn't seem to be autochdir doing this, best I can tell. I don't know what plugin is changing the directory or how to prevent it -- any ideas?

@githorse
Copy link
Author

Got it: it's the project.nvim plugin. See #2238. The immediate fix is to disable the plugin:

lvim.builtin.project.active = false

This turns off the code that was updating cwd whenever I changed buffers. Theoretically I can also set the project root to ".git" and that would probably also work:

lvim.builtin.project.patterns = { ".git" }

(In my case I decided project.nvim wasn't adding much for my current workflow so just turned it off.)

But figuring this out was harder than it should have been, and the defaults here clearly didn't do what I wanted/expected in my Javascript monorepo, so I'll leave this issue open.

Copy link
Contributor

github-actions bot commented May 4, 2024

This issue is stale because it has been open for 50 days with no activity.

@github-actions github-actions bot added the stale label May 4, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

1 participant