Cursor not able to read files and codebase structure?

Hi there, I’m currently testing Cursor and so far I really like it! Big improvement over VS Code and Copilot.

However, I can’t get Cursor to reliably access and read my codebase and its structure. For example:

The project folder that is opened in the workspace is a local repo containing both “pulumi” and the “functions” folder.

Is this behaviour expected? I thought Cursor would be able to answer such queries by looking through the indexed files in the respective folders.

Thanks very much, Richard

Hi @richartkeil

Check here to see if your codebase is indexed.

Hi @deanrie, yes it seems to be fully indexed:

I have the same issue. Index is full, but it won’t search codebase, only if I mention file by name directly.
I’ve tried to restart, update, I’ve even uninstalled cursor, cleaned all remainings, so it started clean with training how to use it - no changes.
I’ve checked “Output” logs of all related to cursor - no errors anywhere, no errors when indexing and no errors when trying to access codebase, it just doesn’t work - it used to show files it feeds to model now it’s empty list
It started around 0.42.2 but seems not right after update but some time after.

Thanks for the info.

Cursor indexing seems to be ignoring all the files defined on your repo .gitignore by default.

If that’s the case, as a workaround you can move the ignored files to your global ~/.gitignore.

Hope that helps

1 Like

Mh, the relevant folders and files are not ignored by a .gitignore, they are normal source code from the repo. Also .curserignore is empty.

I have also recreated the index and saw that it indexed the folders and files in question.

That’s strange. I have some very large .NET repos (450k lines, well over 100 files) that I indexed and was able to query with @Codebase just yesterday (10/19/2024).

My version info is: Version: 0.42.2
VSCode Version: 1.93.1
Commit: c499aee5f16e67815c7dc795ff338dc8ab3e07f0
Date: 2024-10-12T05:39:54.471Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
I’ve been using the Sonnet 3.5 model.

Perhaps create a brand new test branch and add 10-15 new files and paste some code in them then index and query it.

I think I have identified what is causing the issue: Apparently Cursor only indexes / accesses only the first folder when working with code-workspaces. See bug report here.

When opening a normal folder, everything works as expected. Both with indexing enabled and disabled (when disabled, Cursor writes out a plan and queries the files live).

But when using a workspace, Cursor cannot access the files. Independent of indexing.

It would be great to allow Cursor access to all workspace folders or at least somehow indicate that not all folder are visible to Cursor.

1 Like

It’s definitely not an issue I have
I have a full index, it indexes for several minutes and all files are in index, but it just doesn’t search.
Moreover - it’s project specific, I have 2 large Ruby On Rails project where it’s happening
It’s not happening on a Node.js (small) and a Python project (extra large) projects

Where it works it shows file doing codebase search, where it doesn’t work - it thinks for a second showing empty files list and then replies like it doesn’t have access to any files

Hm, weird, I’ve just decided to test it, and it worked! Without anything done on my side, just searched and it used files as it used to be - no install new version, uninstall, cleaning etc.

I guess it was a bug on cursor side that’s gone now, good job for fixing it!

1 Like

Got a workaround for this. Click and drag relevant files to composer or chat. then ask cursor what files does it see to verify it can see what you just added. then ask cursor to add a random comment to each file. notice the files being added to context in composer. then just reject the update. Composer will now track all the files it attempted to update. this works for me in all cases, workspace or not.

In my experience:

  • Cursor’s “Chat” needs you to explicitly give it access to files. I assume the codebase being indexing offers “Chat” the ability to show you a list of context (after you click the + button).¹

  • Cursor’s “Composer” in “agent” mode (not “normal” mode) will implicitly have access to your entire project.

    Screensots


¹ This seems good for security.
² This seems bad for security. See Security Concerns with .gitignore, .cursorignore, .cursorban concern #2.