Commit log

14ff411 Detect and fix broken lsp installations (#2646)

Click to expand commit body
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Closes
https://linear.app/zed-industries/issue/Z-665/add-a-mechanism-for-detecting-and-fixing-broken-language-server
Fixes https://github.com/zed-industries/community/issues/1671
Fixes https://github.com/zed-industries/community/issues/1691
Fixes https://github.com/zed-industries/community/issues/1524
Fixes https://github.com/zed-industries/community/issues/1352
Fixes https://github.com/zed-industries/community/issues/1109
Fixes https://github.com/zed-industries/community/issues/996
Fixes https://github.com/zed-industries/community/issues/782

Things this PR does:
 - Updates our elixir-ls fetching to use new release name format
 - Detect when a server fails to launch
   - If the adapter claims to be reinstallable, get a test binary
   - If the test binary fails to launch or returns a failure error code
   - Clear container dir and reinstall
 - Detect/fix broken Node
 
Things it does not do:
- Restart server on failure, I have most of the stuff for this already
so it should be a fast follow up
 - Detect/fix broken Copilot

Node and Copilot shouldn't be too bad, they are handled via different
mechanisms. Originally I put effort into detecting failure of the server
during normal operation post launch, but that's not really needed. If
the server gets borked while running then we'll catch that on next
startup. Realizing that allowed for pruning a bunch of the work I did
and made the overall system a lot nicer

Copilot is nominally a language server but does not have an adapter and
does not run through the same mechanism in the project.

We're going to have an issue with multiple language server instances in
different projects once we add a "Reinstall Language Server" action,
which is why it's not in this PR. Each project has its own list of
server instances and is currently vaguely responsible for managing the
installations which means they can step on each others toes. This should
change, probably

Release Notes:
- Added a mechanism to detect and reinstall broken language servers
([#1691](https://github.com/zed-industries/community/issues/1691))
([#1524](https://github.com/zed-industries/community/issues/1524))
([#1352](https://github.com/zed-industries/community/issues/1352))
([#1109](https://github.com/zed-industries/community/issues/1109))
([#996](https://github.com/zed-industries/community/issues/996))
([#782](https://github.com/zed-industries/community/issues/782)).

Julia created

6ffa6af fmt

Mikayla Maki created

e0d6188 Add click out handler

Click to expand commit body
Make all context menus on button click toggles instead of re-shows

Mikayla Maki created

2e162f8 WIP convert to `snake_case`

Nate Butler created

fd68a2a Debounce searches in semantic search modal

Max Brunsfeld created

bfdd082 Resolve TS errors and warnings

Click to expand commit body
TODO: Use StyleTree types to remove `any`s from styleTrees.

Nate Butler created

2ed0284 Stub out for language plugin

Julia created

48bed2e Merge branch 'main' into fix-broken-lsp-installations

Julia created

1177980 Fix basic eslint errors

Nate Butler created

db2b3e4 Reinstall Node whenever a NodeRuntime operation has serious error

Julia created

e30ad91 wip

Nate Butler created

85e7141 updated embedding database calls to maintain project consistency

Click to expand commit body
Co-authored-by: maxbrunsfeld <max@zed.dev>

KCaverly and maxbrunsfeld created

400d397 updated both indexing and search method for vector store, to maintain both zed worktree ids and db worktree ids

Click to expand commit body
Co-authored-by: maxbrunsfeld <max@zed.dev>

KCaverly and maxbrunsfeld created

3ca3de8 Merge branch 'main' of github.com:zed-industries/zed into vector_store

KCaverly created

0b900f4 Fix project panel bug (#2656)

Click to expand commit body
Release Notes:

* Fix a bug where project panel entries would not be styled correctly
(preview only)

Mikayla Maki created

1d4a922 prettier format

Mikayla Maki created

bf2c2fe fix bug with dragged entry

Mikayla Maki created

cf8e0be Update

Nate Butler created

40ff777 WIP: Working modal, without navigation and search on every keystroke

KCaverly created

4659c34 WIP: Fix style overwriting in project panel

Mikayla Maki created

18dd310 WIP: Add click out event to fix context menus

Mikayla Maki created

6c53653 v0.94.x dev

Joseph T. Lyons created

ce52d90 Collab UI v2 (#2618)

Click to expand commit body
This PR implements
https://www.figma.com/file/pLq7dvhx2mFeWFOedXpUQ5/Project-%E2%80%93-Collaboration-UI?type=design&node-id=666%3A8610&t=XFGk6KEtTCFXBvCQ-1

Release notes:
- [x] Redesigned collaboration UI
- [x] Added voice support

Mikayla Maki created

cb782c5 Remove menu tracking state

Mikayla Maki created

34b81e2 collab 0.15.0

Max Brunsfeld created

88b30de fmt

Mikayla Maki created

9ab0efa Fix microphone and speaking styles

Mikayla Maki created

00212d4 Handle new elixir-ls release zip name (#2655)

Click to expand commit body
Fix downloading Elixir being broken

Release Notes:

- N/A
(Should be mentioned in 0.92.x)

Julia created

1882ce4 Handle new elixir-ls release zip name

Julia created

c381e88 Update icon sizes

Nate Butler created

a889f3d Reduce the right spacing of the contacts menu

Nate Butler created

49ce197 Optimize user menu trigger

Piotr Osiewicz created

c2f5855 Fix warning

Piotr Osiewicz created

456be1f Hide user menu on second click

Piotr Osiewicz created

dddff64 tests: Test 'db' package sequentially (#2654)

Click to expand commit body
/cc @as-cii  @nathansobo  

Release Notes:

- N/A

Piotr Osiewicz created

9d19dea updated vector_store to remove parsing module

KCaverly created

2cb4616 Enable assistant on stable

Click to expand commit body
Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Antonio Scandurra and Nathan Sobo created

0d0c71e Polish assistant (#2653)

Click to expand commit body
This is a mix of styling and behavioral improvements to the assistant
that we wanted to land before shipping today.

Release Notes:

- N/A

Antonio Scandurra created

8f8a99d Bind cmd-? to assistant::toggle_focus

Click to expand commit body
Bypass system help menu shortcut at the app delegate level to achieve this.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>

Nathan Sobo and Antonio Scandurra created

2ddf0e1 Undeafen: unmute if user was not muted prior to deafening

Piotr Osiewicz created

7efcd60 Remove border from assistant message header

Click to expand commit body
Also: Increase right margin on token count to space it from the scrollbar.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>

Nathan Sobo and Antonio Scandurra created

83fc7b9 Avoid scrolling to the new cursor position so the assistant's output is stable

Click to expand commit body
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>

Nathan Sobo and Antonio Scandurra created

f52d3ea Clean up tooltips, create conversation on cmd-n

Click to expand commit body
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>

Nathan Sobo and Antonio Scandurra created

d41a7f4 Space out assistant icons to match pane icons

Click to expand commit body
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>

Nathan Sobo and Antonio Scandurra created

749f60b fmt

Mikayla Maki created

5d02b49 Added muted and currently speaking tracking

Mikayla Maki created

f128cf4 Defer scanning some worktree subdirectories until they are expanded in the project panel (#2622)

Click to expand commit body
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.

Max Brunsfeld created

201188f Use FakeFs in worktree gitignore test

Max Brunsfeld created

fc02381 Fix bugs in handling combined injections exposed by HEEx (#2652)

Click to expand commit body
Fixes
https://linear.app/zed-industries/issue/Z-2481/heex-this-snippet-triggers-a-hard-crash

Release Notes:

- Fixed a crash that would sometimes occur when editing a HEEx file
([#1703](https://github.com/zed-industries/community/issues/1703)).

Max Brunsfeld created

81c26cf Fix bugs in handling combined injections exposed by HEEx

Max Brunsfeld created