Skip to content

Respect .gitignore (or further refine ignores) for project indexer #14237

Open

Description

@kevinushey

Currently, the RStudio file indexer is quite slow to start up when using rstudio itself as the open project. This is because the project indexer crawls all directories, including build directories and dependency directories.

We should consider if we could augment the ignore lists here:

bool ProjectContext::fileMonitorFilter(
const FileInfo& fileInfo,
const FileMonitorFilterContext& context) const
{
// note that we check for the component occurring anywhere in the
// path as the Windows file monitor watches all files within the
// monitored directory recursively (irrespective of the filter)
// and so we need the filter to apply to files which are 'ignored'
// and yet still monitored in ignored sub-directories
std::string path = fileInfo.absolutePath();
for (auto&& component : context.ignoredComponents)
if (boost::algorithm::icontains(path, component))
return false;
return module_context::fileListingFilter(fileInfo, context.ignoreObjectFiles);
}

which itself is used here:

Error error = scanFiles(FileInfo(filePath), options, &pContext->fileTree);

so that we can avoid indexing directories unnecessarily.

Some potential options:

  1. Read and apply .gitignore rules to the files we scan?
  2. Add some official mechanism for declaring what files / directories should be ignored in a particular project? (Project UI preference?)
  3. Something else?

Activity

  1. added this to the Product Backlog milestone on Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions