Skip to content

Enhanced worktree support #31

@JesseHerrick

Description

@JesseHerrick

Why?
Right now, opening a new worktree requires reindexing the entire codebase. This is fine for small codebases, but for super large ones, it's a 10-12 second hit. Since the files themselves haven't changed when you open up a worktree, we shouldn't need to reindex here.

The reason why re-indexing is required at the moment is because we store all paths as absolute paths. Since a worktree is opened in a new dir, the paths need to be updated. One option considered is doing a mass update of paths to reflect the new worktree path, but this would actually be almost as slow as reindexing entirely due to the need to recreate or update the indices in the DB, along with the write time.

What would you like to see?

Here's the general plan:

  • Store almost everything with relative paths to the project root.
  • Edge case: Elixir stdlib is referenced via an absolute path on the user's computer, so we should keep these absolute.
  • On all operations with a filepath, prepend the project root. However, if the path starts with / (Elixir stdlib paths), treat it as absolute and don't prepend.
  • Test switching worktrees to see if we need additional logic to update the project root or if everything will just work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions