Commit Graph
68 Commits
Author SHA1 Message Date
Nathan SoboandMax Brunsfeld 1a21902460 Move fuzzy mod out of worktree
We now match against arbitrary strings in addition to paths.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-04 17:46:53 -06:00
Nathan Sobo 85a076312a Merge branch 'main' into theme-variables 2021-08-04 16:47:43 -06:00
Max BrunsfeldandNathan Sobo b30d0daabf Add a theme picker
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 14:55:27 -07:00
Max Brunsfeld eb05103d2d Fix saving an untitled file outside of any existing worktree 2021-07-30 14:19:42 -07:00
Antonio Scandurra 8de8c679c7 Fix panic when fuzzy-matching on a Worktree that contains no files
As part of our work on the deterministic executor, in c4e37dc we fixed a
bug that occurred when there were more CPUs than paths to fuzzy-match
on.

However, that introduced another bug that caused Zed to panic when
trying to calculate how many paths should be fuzzy-matched by each
available worker thread for worktrees that didn't contain any file.

This commit bails out early in `fuzzy::match_paths` if the vector of
paths to search is empty.
2021-07-30 09:50:02 -07:00
Max Brunsfeld 7260442d42 Move the fs module out of worktree 2021-07-13 15:40:11 -07:00
Max Brunsfeld dcae4747b0 Decouple Fs trait from Worktree
Make it a more direct shim for the standard FS APIs
2021-07-13 15:40:11 -07:00
Max Brunsfeld 561cabbba2 Use FakeFs in all integration tests 2021-07-13 12:48:00 -07:00
Nathan SoboandMax Brunsfeld 82569a031f Fix race condition in integration test
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-13 13:24:48 -06:00
Nathan SoboandMax Brunsfeld 411e7df931 Move Fs trait into its own module
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-13 12:52:42 -06:00
c4e37dc47c Use the same background executor for spawning CPU intensive tasks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-13 18:13:25 +02:00
Antonio Scandurra f836a25500 Use an executor::Background in AppContext::thread_pool 2021-07-13 14:06:38 +02:00
Antonio Scandurra 59fe0549cc Replace paths_by_id with an entries_by_id sum tree 2021-07-06 12:41:31 +02:00
34963ac80d Use entry_id on File instead of worktree::Diff to detect when buffers' files change
Rather than computing a diff after processing a batch of FSEvents, we instead detect renames as we're inserting entries. We store an entry_id on the File object that is owned by each buffer, and use this to detect when the path of the File has changed.

We now also manage all File-related state and event emission for Buffers in the LocalWorktree, since the logic will need to be totally different in the remote case.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-06-29 18:19:38 -06:00
Antonio ScandurraandNathan Sobo 958345b5ce Assign a stable identity to Worktree entries
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-06-28 19:41:33 +02:00
Nathan SoboandMax Brunsfeld c5e08b6548 Eagerly update worktree entries when saving
Don't use ModelHandles for storing Files.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-22 17:53:35 -07:00
Max Brunsfeld a2a6d67e1e Start work on implementing ::file on remote WorktreeHandles 2021-06-18 13:32:38 -07:00
Antonio Scandurra f9d8e952f2 WIP 2021-06-18 19:28:39 +02:00
Antonio Scandurra 995b80ff26 Index into prefix or path depending on where the match was found
This fixes a couple of tests that were panicking due to an out-of-bound
access.
2021-05-20 12:47:08 +02:00
Max Brunsfeld 4bc1b0fa6f Convert fuzzy match positions to byte offsets 2021-05-20 12:47:08 +02:00
Max Brunsfeld b126938af7 In file finder, handle single-file worktrees & multiple matches w/ same rel path 2021-04-29 12:44:51 -07:00
Max Brunsfeld 75b8f7425d Avoid redundant sort_unstable_by call on merged fuzzy matches 2021-04-27 14:34:29 -07:00
Max Brunsfeld a59b75c839 Keep results stable when using file-finder while scanning files 2021-04-27 14:02:55 -07:00
Nathan Sobo f29f1b073d Preserve selected file finder path when Worktree changes 2021-04-26 20:23:56 -06:00
Max BrunsfeldandNathan Sobo 55fcc586bc Cancel outstanding fuzzy-matching calls before starting a new one
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-26 16:14:43 -07:00
Max Brunsfeld 733dc15c32 Ignore .git directories 2021-04-26 15:46:06 -07:00
Max Brunsfeld e7c594262f Fix handling of uppercase characters in fuzzy finding 2021-04-26 15:04:26 -07:00
Antonio Scandurra 111d98d6c1 Keep ignore status up-to-date as events are processed 2021-04-26 17:55:18 +02:00
Nathan Sobo f770a70929 WIP: Maintain an IgnoreStack while scanning
All ignore files associated with ancestors of the directory currently being scanned are included in the stack. This allows us to compute ignore status for each entry as we initially scan it. If we encounter an ignored directory, we replace the stack with an "ignore all" variant that simply ignores every descendant of the ignored directory.

This is incomplete. We still need to construct an ignore stack in an appropriate state when rescanning subtrees in response to events. It also doesn't deal with individual ignore files being added, removed, or changed. I think we could potentially use the ignore stack while reconstructing the tree for this purpose.
2021-04-24 23:59:03 -06:00
Max BrunsfeldandNathan Sobo 6a7308b87a Avoid storing redundant copies of file paths
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-23 21:17:26 -07:00
Max BrunsfeldandNathan Sobo 054203d21c Fix fuzzy matching after removing root dirname from stored paths
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-23 15:22:47 -07:00
Nathan SoboandMax Brunsfeld dced9469f5 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-23 12:47:23 -06:00
Nathan SoboandMax Brunsfeld c9d7249305 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-23 11:37:23 -06:00
Antonio Scandurra 8f2fc079fd Restructure Worktree to index entries by path 2021-04-23 15:25:59 +02:00
Antonio Scandurra 9723e46af4 Replace linear scan of entries with a custom FileIter 2021-04-22 17:29:36 +02:00
Antonio Scandurra c429a937be Remove is_ignored from PathEntry and lean more on the tree instead 2021-04-22 16:49:11 +02:00
Antonio Scandurra af3bc236b7 Recompute ignore status when .gitignore changes or for new entries 2021-04-22 15:14:23 +02:00
Max Brunsfeld 499e55e950 Start work on handling changes to gitignore files
* Use the published ignore crate
* Store ignore objects on snapshot, and use them to compute
  files' ignored status dynamically, instead of storing the
  ignored status on the file.
2021-04-21 18:11:52 -07:00
Max BrunsfeldandNathan Sobo 8e0ca2056e Store paths as strings on PathMatch structs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-21 12:05:34 -07:00
Antonio ScandurraandMax Brunsfeld 122926dcde WIP: Associate entry names with directory children
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-04-19 20:16:54 +02:00
Nathan Sobo 358fad8242 Replace the old worktree with the new one 2021-04-15 21:02:30 -06:00
Nathan Sobo 5648c67d54 Perform path matching on Worktree snapshots
We're going to need something that can be moved to a background thread. Worktree used to be easy to clone, but that's no longer really true. Instead we can take a snapshot.
2021-04-15 20:29:45 -06:00
Antonio ScandurraandNathan Sobo cefc753123 Re-introduce fuzzy-matching on the new WorkTree implementation
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-15 18:18:53 +02:00
Nathan SoboandAntonio Scandurra cbc1d83067 Get worktree out of the way so we can try again
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-14 11:09:06 -06:00
Nathan SoboandBrooks Swinnerton 26f9127e83 Spawn worktree scanning on the scoped pool
Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
2021-04-13 20:09:45 -06:00
Nathan SoboandBrooks Swinnerton e4f41de7bf Invert condition when opening entries
Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
2021-04-13 20:09:45 -06:00
Nathan Sobo f3a0a11fc5 WIP 2021-04-13 20:09:45 -06:00
Nathan Sobo bc34ff54fe Add a failing test for detecting a file move 2021-04-13 20:09:45 -06:00
Nathan Sobo 41f50cdb61 Require a context when constructing a worktree 2021-04-13 20:09:45 -06:00
Nathan Sobo 24cdfd2471 Identify Worktree entries by their inode
This will allow us to re-parent elements when re-scanning when the file system changes.
2021-04-13 20:09:41 -06:00