Commit graph

37 commits

Author SHA1 Message Date
Max Brunsfeld
b30d0daabf Add a theme picker
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 14:55:27 -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
Antonio Scandurra
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
Nathan Sobo
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 Scandurra
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 Sobo
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 Brunsfeld
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
e7c594262f Fix handling of uppercase characters in fuzzy finding 2021-04-26 15:04:26 -07:00
Max Brunsfeld
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 Brunsfeld
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 Sobo
dced9469f5 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-23 12:47:23 -06:00
Nathan Sobo
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 Brunsfeld
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 Scandurra
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 Scandurra
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 Sobo
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 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
Nathan Sobo
0cc5e8f742 Replace easy-parallel with scoped-pool for path searches
The easy-parallel crate spawned new threads on each call, which was resulting in way too many threads.

Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
2021-04-13 20:07:42 -06:00
Nathan Sobo
171dd0c243 WIP 2021-03-18 13:17:25 -06:00
Nathan Sobo
23308e17a9 WIP on rebuilding with extracted UI framework 2021-03-18 13:13:31 -06:00