Commit Graph
793 Commits
Author SHA1 Message Date
Kirill Bulatov 8fd476141a When renaming in project panel, select file names without extensions 2023-07-21 23:22:22 +03:00
Kirill Bulatov aae5cf61e1 Add search in directory action in the project panel 2023-07-21 22:47:57 +03:00
Mikayla Maki 8dbc619544 fmt 2023-07-20 13:45:19 -07:00
Derek Briggs 083552ec62 add indent size to project panel settings 2023-07-20 12:30:35 -06:00
Derek Briggs 6bc776e7e9 organize settings 2023-07-20 12:23:47 -06:00
Derek Briggs 2ce3481068 Allow for folders or chevrons 2023-07-20 12:23:28 -06:00
Derek Briggs 183f95508a Add moar icons 2023-07-20 12:01:41 -06:00
Mikayla Maki f9d722e8fd Add a few more spare associations 2023-07-19 11:14:31 -07:00
Mikayla Maki 71b800391f fmt 2023-07-19 11:10:31 -07:00
Derek Briggs 82ab668575 Fix files that don’t have a prefix 2023-07-19 11:10:30 -07:00
Mikayla Maki b5a68644cb fmt 2023-07-19 11:10:30 -07:00
Mikayla Maki 157e96bc4d Make file types live reload 2023-07-19 11:10:30 -07:00
Mikayla Maki 8db0da3e30 Fix tests 2023-07-19 11:10:30 -07:00
Mikayla Maki 98f263639e Added file suffix and icon associations data 2023-07-19 11:10:30 -07:00
Mikayla Maki e68edb7239 Add settings 2023-07-19 11:10:30 -07:00
Mikayla Maki 36d33e77f0 Add suffix based file icons 2023-07-19 11:10:30 -07:00
Joseph T. Lyons 1efda4a2b0 Require only a single click to split pane when using cmd in project panel 2023-07-14 18:27:40 -04:00
Alex ViscreanuandMikayla Maki ef7952c045 feat(workspace): allow alternative actions to open files and symbols in split
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2023-07-14 21:49:15 +02:00
Mikayla Maki 91f2a5401c fmt and update dependency 2023-06-29 17:49:42 -07:00
Mikayla Maki 742da534a2 Fix edge case with absolute file paths 2023-06-29 17:48:01 -07:00
Mikayla Maki f416d9ef00 Add the ability to make new directories by adding slashes to a file name 2023-06-29 17:35:22 -07:00
Max Brunsfeld 59ef9557b3 Defer scanning some worktree subdirectories until they are expanded in the project panel (#2622)
Closes
https://linear.app/zed-industries/issue/Z-352/high-memory-usage-from-fs-scanning-if-project-contains-symlinks-that

### Background

Currently, when you open a project, Zed eagerly scans the directory,
building an in-memory representation of all of the files and directories
within. This scanning includes all git-ignored files and follows any
symlinks. When any directory changes on disk, Zed recursively rescans it
in order to keep its in-memory representation up-to-date. When
collaborating, all of these files are replicated to all guests.

Right now, there are some performance problems associated with the
maintenance of this filesystem state:
* For various reasons, some projects contain symlinks that point out to
large folders like `$HOME`, which itself contains many symlinks that
point to the same large directory. When these projects are opened, the
worktree scans endlessly, using more and more memory.
* Some git-ignored directories (like `target` in a rust project) contain
*many* more files than are actually tracked in the git repository. These
files often change as a result of saving, (e.g. because the compiler
runs). Maintaining in memory all of these paths isn't useful to the
user, and causes significant CPU usage on every save. Most importantly,
when collaborating sending all of these changes to guests can be slow,
and can delay all other RPC messages.

### Change

This PR changes the worktree's filesystem-scanning logic to be *lazy*
about scanning two types of directories:
* git ignored directories
* "external" directories (those that are canonically located outside of
the worktree root, but accessed via symlinks)

The laziness works as follows. When, during a recursive scan, a
directory is found that falls into one of the above 2 categories, that
directory is marked as "unloaded". The directory might later be scanned,
if some explicit operation is performed within it (like opening a
buffer, or creating a file), if any collaborator expands that directory
in their project panel, or if an LSP requests that it be watched.

### Results

When collaborating on the `zed` folder:

| metric | before | after |
|-------|--------|------|
| # `worktree_entries` in collab db initially | 154,763 |  77,679 |
| # `worktree_entries` in collab db after 5 saves | 181,952 | 77,679
(nothing new to scan) |
| app memory footprint (host) | 260MB | 228.5 MB  |

The db thing is a win, because reading and writing to the
`worktree_entries` table is one of the most expensive thing that the
`collab` server does.

There's also generally lower background CPU usage after every save,
because we don't need to recursively rescan directories inside of
`target`.

### Limitations

We still end up scanning some unnecessary directories (like
`target/debug/build/zed-b612db829aeac16e/out`) because the LSP instructs
us to watch those.

### To do:

* [x] Expand parent directories of any path opened via LSP
* [x] Avoid creating orphaned entries when FS events happen inside of
unscanned directories
* [x] Scan any newly-non-ignored directories after gitignore changes
* [x] Emit correct events for newly-discovered paths when expanding dirs
* [x] GC the set of expanded directory ids when dirs are removed
* [x] Don't include "external" entries in file-finder
* [x] Expand any directories watched by LSP
* [ ] manual testing and profiling

### Release Notes:

- Fixed a bug where Zed would use excessive memory when a project folder
contained symlinks pointing to directories outside of the project.
- Reduced Zed's memory and CPU usage when working in folders containing
many git-ignored files.
2023-06-27 17:07:23 -07:00
Antonio Scandurra 6883910a1f Merge remote-tracking branch 'origin/main' into save-conversations 2023-06-23 09:09:42 +02:00
Max Brunsfeld b6b17a473c Fix project panel test helper 2023-06-22 17:02:01 -07:00
Max Brunsfeld dbfa5136e9 Get integration test passing. Wait for expand entry on remote projects. 2023-06-22 10:34:28 -07:00
Max Brunsfeld e7aacf59c8 Add a bit to each entry indicating if it's outside of the worktree root 2023-06-22 10:34:28 -07:00
Max Brunsfeld 6690be7b40 Remove logic for marking worktree entries as collapsed 2023-06-22 10:34:28 -07:00
Max Brunsfeld 0ed4f130dd Only scan ignored or externals paths if expanded in a project panel 2023-06-22 10:34:28 -07:00
Max Brunsfeld 5850c521c9 Maintain on the background scanner a set of expanded directories 2023-06-22 10:34:28 -07:00
Nathan SoboandJulia Risley b310fcc367 Remove the nested Pane from the assistant
Since we don't want tabs, I think it would be better to render the toolbar
for ourselves directly and handle switching between conversations.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 18:52:48 -06:00
Piotr Osiewicz d67640e475 Rename on/off states to active/inactive 2023-06-20 16:05:23 -07:00
Piotr Osiewicz 406e160730 Split out Interactive<T> into Toggle<T> and Interactive<T> 2023-06-20 16:05:20 -07:00
Mikayla Makiandmax 032d8e4aa1 Improve test generation and implement status propogation
co-authored-by: max <max@zed.dev>
2023-06-05 17:30:12 -07:00
Mikayla Maki af3189be5b WIP: Add status bubbling to project panel 2023-06-05 12:53:04 -07:00
Mikayla MakiandJulia 3df36f560f WIP: Move statuses to be on their associated file entries in worktree
co-authored-by: Julia <julia@zed.dev>
2023-05-31 11:03:11 -07:00
Kirill Bulatov 2f77518455 Fix duplicate item creation in project panel 2023-05-26 02:07:25 +03:00
Julia a3bc3f85a9 Clean up final remaining code paths calling old diff update method 2023-05-25 14:41:09 -04:00
Julia a1b4c57588 Fix tests 2023-05-25 14:29:28 -04:00
Antonio ScandurraandNathan Sobo 4275468260 Show keystroke in panel tooltips
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-05-24 16:13:58 +02:00
Antonio Scandurra dee6f22ca2 Merge remote-tracking branch 'origin/main' into panels 2023-05-23 08:24:28 +02:00
Mikayla Maki 0f5e271f17 Add other setting init 2023-05-22 20:38:30 -07:00
Mikayla Maki a8c4c826fe Add init_settings to tests 2023-05-22 20:33:18 -07:00
Mikayla Maki 44bff08fd7 fmt 2023-05-22 20:25:27 -07:00
Mikayla Maki b9317166d5 Add initial project panel settings 2023-05-22 20:23:07 -07:00
Mikayla Maki b3d5acd22d fmt 2023-05-22 15:53:29 -07:00
Mikayla Makiandnate ffd3927a70 Fixed contrast in project panel and scrollbar
co-authored-by: nate <nate@zed.dev>
2023-05-22 15:51:31 -07:00
Mikayla Maki 2a904640c8 Revert "Touch up git in project panel and scroll bar styling" 2023-05-22 15:31:14 -07:00
Mikayla Maki c627091f51 fmt 2023-05-22 15:04:51 -07:00
Mikayla Maki ec9d869ac9 Wire in conflict styling 2023-05-22 10:10:47 -07:00
Mikayla Maki a98f93f7c0 Wire project panel themes into rust 2023-05-22 09:55:59 -07:00