### Summary
This PR adds support for count and object motions to the toggle comments
action in Vim mode. The relevant issue is
[#14337](https://github.com/zed-industries/zed/issues/14337).
For example, `2 g c j` will toggle comments three lines downward. `g c g
g` will toggle comments from the current cursor position up to the start
of the file.
Notably missing from this PR are `g c b` (toggle comments for the
current block) as well as `g c p` (toggle comments for the current
paragraph). These seem to be non-standard.
The new module `normal/toggle_comments.rs` has been copied almost
verbatim from `normal/indent.rs`. Maybe that ought to be abstracted over
but I feel I lack the overview.
Release Notes:
- vim: Added support for count and object motion to the toggle comments
action ([#14337](https://github.com/zed-industries/zed/issues/14337)).
Enables the jupyter feature by default, which is shown only when we have
a kernelspec or know that we (can) support it well (Python,
Deno/TypeScript).
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR adds a new menu entry in the REPL item in the quick action bar
to open up the REPL sessions view:
<img width="232" alt="Screenshot 2024-07-22 at 4 54 36 PM"
src="https://github.com/user-attachments/assets/acc60a25-7722-4331-9b80-fab9cca65842">
This makes this more discoverable than having to know that the command
exists.
Release Notes:
- N/A
This PR removes the REPL panel and replaces it with a new sessions view
that gets displayed in its own pane.
The sessions view can be opened with the `repl: sessions` command (we
can adjust the name, as needed).
There was a rather in-depth refactoring needed to extricate the various
REPL functionality on the editor from the `RuntimePanel`.
<img width="1136" alt="Screenshot 2024-07-22 at 4 12 12 PM"
src="https://github.com/user-attachments/assets/ac0da351-778e-4200-b08c-39f9e77d78bf">
<img width="1136" alt="Screenshot 2024-07-22 at 4 12 17 PM"
src="https://github.com/user-attachments/assets/6ca53476-6ac4-4f8b-afc8-f7863f7065c7">
Release Notes:
- N/A
Configures inline completions to delete the remaining text on the given
line. This doesn't affect the github copilot inline completion provider
since it seems to only generate suggestions if the cursor is at the end
of the line but fixes the usability issues related to Supermaven.
https://github.com/user-attachments/assets/1b8bc9a3-4666-4665-a436-96e4beee01bb
Release Notes:
- Fixed https://github.com/zed-industries/zed/issues/13039
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This PR factors a `ReplStore` out of the `RuntimePanel`.
Since we're planning to remove the `RuntimePanel` and replace it with an
ephemeral tab that can be opened, we need the kernel specifications and
sessions to have somewhere long-lived that they can reside in.
Release Notes:
- N/A
Simplify key dispatch code.
Previously we would maintain a cache of key matchers for each context
that
would store the pending input. For the last while we've also stored the
typed prefix on the window. This is redundant, we only need one copy, so
now
it's just stored on the window, which lets us avoid the boilerplate of
keeping
all the matchers in sync.
This stops us from losing multikey bindings when the context on a node
changes
(#11009) (though we still interrupt multikey bindings if the focus
changes).
While in the code, I fixed up a few other things with multi-key bindings
that
were causing problems:
Previously we assumed that all multi-key bindings took precedence over
any
single-key binding, now this is done such that if a user binds a
single-key
binding, it will take precedence over all system-defined multi-key
bindings
(irrespective of the depth in the context tree). This was a common cause
of
confusion for new users trying to bind to `cmd-k` or `ctrl-w` in vim
mode
(#13543).
Previously after a pending multi-key keystroke failed to match, we would
drop
the prefix if it was an input event. Now we correctly replay it
(#14725).
Release Notes:
- Fixed multi-key shortcuts not working across completion menu changes
([#11009](https://github.com/zed-industries/zed/issues/11009))
- Fixed multi-key shortcuts discarding earlier input
([#14445](https://github.com/zed-industries/zed/pull/14445))
- vim: Fixed `jk` binding preventing you from repeating `j`
([#14725](https://github.com/zed-industries/zed/issues/14725))
- vim: Fixed `escape` in normal mode to also clear the selected
register.
- Fixed key maps so user-defined mappings take precedence over builtin
multi-key mappings
([#13543](https://github.com/zed-industries/zed/issues/13543))
- Fixed a bug where overridden shortcuts would still show in the Command
Palette
Per the LSP spec, we should pass .data field of diagnostics into code
action request:
```
/**
* A data entry field that is preserved between a
* `textDocument/publishDiagnostics` notification and
* `textDocument/codeAction` request. *
* @since 3.16.0 */ data?: LSPAny;
```
Release Notes:
- Fixed rare cases where a code action triggered by diagnostic may not
be available for use.
The git blame dialog doesn't give the user a way to quickly copy the SHA
of the associated commit for a line. Adding an option for users to
quickly access this SHA is helpful for user's to do any more git-fu they
might need, such as viewing the full changes themselves within git,
checking the commit out, bisecting off the commit, etc.
This is also very handy for user's of self-hosted git providers.
Determining what provider a self-hosted repository is using could be
quite difficult and this presents an easy option to allow users to look
up more about a commit without having to memorize the short SHA.
Release Notes:
- Added a button to copy the SHA from a Git blame entry.
<img width="1552" alt="A screenshot showing the new copy SHA button
within the Zed editor's inline blame "
src="https://github.com/user-attachments/assets/9365950d-3a3f-4c11-b119-ab02654f5669">
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR updates a number of spots where we were setting all of the
`TextStyle` fields even if we were not changing the values from the
defaults.
We now use `..Default::default()`.
Release Notes:
- N/A
This PR updates the `ImageCacheError::BadStatus` variant to include the
URI of the image that failed to load.
This helps contextualize the resulting error logs.
Release Notes:
- N/A
This PR bumps the hard-coded Node.js version from v18.x (Hydrogen), which was LTS until October 2023, to v22.x (Jod) which will be the next LTS release in October 2024.
Release Notes:
- Updated Zed's node version (v18.x -> v22.x)
* Fixed mis-named macOS remote server archives in actions and packaging
scripts
* Fixed an issue with the ask pass script on linux
* Download nightly versions of remote servers in dev mode (not stable)
Release Notes:
- N/A
This PR replaces the `Into<ElementId> for BlockId` implementation with
`From<BlockId> for ElementId`.
This keeps in line with Rust's guidance for preferring implementing
`From`, and gives us more flexibility when converting.
Release Notes:
- N/A
This PR reworks the `Tab` component to not use absolute positioning in
order to position the tab slots.
This should make any further adjustments we want to make to the spacing
easier to do.
Release Notes:
- N/A
We will soon need `semantic_index` to be able to use
`CompletionProvider`. This is currently impossible due to a cyclic crate
dependency, because `CompletionProvider` lives in the `assistant` crate,
which depends on `semantic_index`.
This PR breaks the dependency cycle by extracting two crates out of
`assistant`: `language_model` and `completion`.
Only one piece of logic changed: [this
code](922fcaf5a6 (diff-3857b3707687a4d585f1200eec4c34a7a079eae8d303b4ce5b4fce46234ace9fR61-R69)).
* As of https://github.com/zed-industries/zed/pull/13276, whenever we
ask a given completion provider for its available models, OpenAI
providers would go and ask the global assistant settings whether the
user had configured an `available_models` setting, and if so, return
that.
* This PR changes it so that instead of eagerly asking the assistant
settings for this info (the new crate must not depend on `assistant`, or
else the dependency cycle would be back), OpenAI completion providers
now store the user-configured settings as part of their struct, and
whenever the settings change, we update the provider.
In theory, this change should not change user-visible behavior...but
since it's the only change in this large PR that's more than just moving
code around, I'm mentioning it here in case there's an unexpected
regression in practice! (cc @amtoaer in case you'd like to try out this
branch and verify that the feature is still working the way you expect.)
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This is a first step towards allowing you to edit remote projects
directly over SSH. We'll start with a pretty bare-bones feature set, and
incrementally add further features.
### Todo
Distribution
* [x] Build nightly releases of `zed-remote-server` binaries
* [x] linux (arm + x86)
* [x] mac (arm + x86)
* [x] Build stable + preview releases of `zed-remote-server`
* [x] download and cache remote server binaries as needed when opening
ssh project
* [x] ensure server has the latest version of the binary
Auth
* [x] allow specifying password at the command line
* [x] auth via ssh keys
* [x] UI password prompt
Features
* [x] upload remote server binary to server automatically
* [x] opening directories
* [x] tracking file system updates
* [x] opening, editing, saving buffers
* [ ] file operations (rename, delete, create)
* [ ] git diffs
* [ ] project search
Release Notes:
- N/A
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This fixes#14818.
The change in #14055 broke the tasks in `zsh` (and I suspect in `bash`,
`sh` too), because what was executed was NOT
$ go test . -run '^TestThis$'
but instead this:
$ go test . -run \'^TestThis$\'
And in `zsh` this means that `'` is part of the argument passed to `go`,
which means the targeting string is wrong.
Since the problem in `fish` doesn't seem to be the `^` but the `$`, we
can only escape that, which makes the escaped string work in `zsh` and
`fish` and `bash` (in which I've tested this change here)
Release Notes:
- go: Fix running single tests by changing the quoted expression in the
`go test` command to work again in `bash`, `zsh`, etc.
([#14818](https://github.com/zed-industries/zed/issues/14818))
Cleans up action registration with the editors and also fixes a major
bug where only one workspace's panel was getting session info (due to my
not understanding that `cx.observe_new_views` is for the whole app).
Release Notes:
- N/A
Co-authored-by: Conrad <conrad@zed.dev>
Release Notes:
- Fixed a bug that caused focus to be lost when renames and inline
assists were scrolled offscreen.
---------
Co-authored-by: Nathan <nathan@zed.dev>
Adds a command to refresh kernelspecs. Also added the kernelspecs to the
runtime panel when none are running. That's just for now until we move
out of the panel completely.
Release Notes:
- N/A
Note that this shouldn't have any visible user-facing behavior yet. The
feature is incomplete but we wanna merge early to avoid a long-running
branch.
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>
In the case that a line ended with a 0-length run, we would get our
highlights offset by one position.
Release Notes:
- Fixed syntax highlights being offset from syntax in diagnostics
popovers.
This PR updates the `/docs` slash command with the ability to
just-in-time index a package when there are not yet any results in the
index.
When running a `/docs` slash command, we fist check to see if there are
any results in the index that would match the search.
If there are, we go ahead and return them, as we do today.
However, if there are not yet any results we kick off an indexing task
as part of the command execution to fetch the results.
Release Notes:
- N/A
Sets the account status state to allow the Supermaven button to move out
of the "Supermaven is initializing..." state. We also need to add the
ability to sign out and change tiers but I will do that in a separate
PR.
Release Notes:
- Improved Supermaven status messages
([#12715](https://github.com/zed-industries/zed/issues/12715)).
Fix: #14242
At present, we don't trigger the method `start_recording(cx)` to start
recording when typing add_surround, so it can't be repeated well, delete
and change actually don't increase, but when entering `d` and `c`, it
happens that these two operations are recorded, I think maybe we also
need to call `start_recording(cx)` when calling delete_surround and
change_surround, otherwise when the user modifies their shortcuts, these
two functions may not be supported by repeat
Release Notes:
- N/A
At present, when calculating some ranges, we take the `tuple_windows` to
iterate forward, which will cause some problems when the cursor is being
front, because `tuple_windows` iteration cannot iterate to the very
beginning, so there will be some cases that cannot be calculated, adjust
this method, and now it can calculate more perfectly, and the execution
speed is about the same
Release Notes:
- N/A
For context, see:
-
https://github.com/zed-industries/zed/issues/5124#issuecomment-2227743811
-
https://github.com/zed-industries/zed/pull/14738#issuecomment-2236613976
Short version: on Intel MacBooks it's better to prefer integrated
(`is_low_poer()`) GPUs, except when a user has an eGPU plugged-in, in
which case they very likely want to prefer that.
Before this change, we'd always prefer the integrated GPU, even if an
eGPU was available.
Now, with this change, if a user has
- eGPU
- integrated GPU
- discrete GPU
We'd first prefer eGPU, then integrated, then discrete.
Release Notes:
- Changed preference for GPUs on macOS so that eGPUs are now preferred
over integrated ones (and both of which are preferred over discrete
GPUs) on Intel Macs.
Follow-up of https://github.com/zed-industries/zed/pull/14515
Fixed certain visual artifacts, related to multi line diagnostics and
block toggle rendering.
Also enabled diagnostics toolbar controls for the experimental view too.
Release Notes:
- N/A
This PR adds a `text_color` method to `TabContentParams` to more easily
compute the text color to be used for tab contents.
This consolidates a number of conditionals that were scattered all over
the place to give us a singular source of truth for these colors.
Release Notes:
- N/A
This PR refines the appearance of the channel tabs.
We now display the channel icon in the tab's icon slot. We also now
adjust the icon based on whether the channel is public or members-only
(the same we do in the channel list):
<img width="214" alt="Screenshot 2024-07-18 at 9 02 00 AM"
src="https://github.com/user-attachments/assets/973d83c5-f045-4282-a43a-18e12ce93f78">
The `read-only` and `disconnected` states are now also shown in a
visually different style than the channel name:
<img width="247" alt="Screenshot 2024-07-18 at 9 01 13 AM"
src="https://github.com/user-attachments/assets/359f61cf-3b80-4a3f-8948-d705f6c24695">
Release Notes:
- Refined the appearance of channel tabs.
This is a follow-up to #14666 in which I noticed that we don't need that
additional check, since each request will check whether it's supported
via the call to `check_capabilities` before sending the request.
Release Notes:
- N/A
I decided to remove the GPUI APIs since `chrono` already provides this
functionality, and is already been used for this purpose in other parts
of the code (e.g.
[here](80402a6840/crates/zed/src/main.rs (L756))
or
[here](80402a6840/crates/ui/src/utils/format_distance.rs (L258)))
These usages end up calling the `time_format` crate, which takes in a
`UtcOffset`. It's probably cleaner to rewrite the crate to take in
`chrono` types, but that would require rewriting most of the code there.
Release Notes:
- linux: Use local time zone in chat and Git blame
This fixes https://github.com/zed-industries/zed/issues/13633 by not
sending `source.organizeImports` to the ESLint language server anymore.
Turns out that ESLint tells us through its capabilities that it doesn't
support that code action kind, but we ignored that.
What this code does is to check whether a given server supports specific
code action kinds.
It does this in two places:
1. When constructing the request: we now filter down the list of
requested `kinds`, in case we can do so. If we can't filter down the
list, we keep the previous behavior of sending the
`language_server.code_action_kinds()`
2. Before sending the request: we now check whether the server even
supports sending the request.
This fixes the issue by only sending actions to servers that support it.
I tested this with various language servers and setups and everything
still works (or works better). But of course there are a ton of
different combinations of language servers and code actions and file
types, so I couldn't test them all.
Release Notes:
- Fix ESLint language server adding comments on save if the
`source.organizeImports` code action was used on save. Zed now filters
out code actions sent to the language servers by checking whether they
are supported first.
([#13633](https://github.com/zed-industries/zed/issues/13633)).
Previously, when using Vim mode and doing a line-wise visual selection,
the `assistant: quote selection` action would not work correctly, since
it would ignore that these were line-wise selections.
With this change, one can now select lines using visual line mode and
"quote selection works"
Release Notes:
- Fixes `assistant: quote selection` not working correctly when making
visual-line-mode selections in Vim mode.
Fixes an issue in the serialization of workspaces that lead to incorrect
ordering of worktrees and refactors some other parts of the code to use
the new method.
Release Notes:
- N/A
This PR adds a streamlined way to consistently construct tab content for
items that only have textual content in the tabs.
The `Item` trait now has a new `tab_content_text` method that can be
used to return the textual content for the tab.
The `tab_content` method now has a default implementation that—unless
overridden—will construct a `Label` out of the text. This default
implementation also takes care of setting the label color based on the
active state of the tab, something that previously had to be repeated in
each `tab_content` implementation.
The majority of our tabs are now using `tab_content_text`.
Release Notes:
- N/A
This PR refactors the `set_active_pane_item` implementation for
`Breadcrumbs` to use an early return to avoid indenting the method body
more than necessary.
Release Notes:
- N/A
This PR improves the multibuffer hints added in #14668 to fix a few
issues.
The original implementation relied on bailing out early in `render` by
returning an `Empty` element. However, this had the unintended
side-effect that when initially opening a multibuffer (such as the
project search) there would be additional whitespace increasing the
height of the toolbar due to the empty element.
The reason we were doing this in the first place was because the hints
weren't updating when the item's breadcrumbs changed.
We're able to address this properly by using a subscription to the
item's events and recompute the visibility of the hint when the active
item's breadcrumbs change.
This also has the benefit of making the hints re-appear right away when
running the `welcome: reset hints` command with a multibuffer open.
Release Notes:
- N/A
This PR reworks the rendering for tab icons to allow us to render all of
the tab icons—not just file icons—in the tab's start slot.
The `Item` trait now has a separate `tab_icon` method that can be used
to indicate what icon should be shown for the tab.
Release Notes:
- N/A
This PR makes it so dev extensions that are installed are excluded when
checking for extension updates.
We don't want to accidentally clobber dev extensions if the upstream
extension is deemed more "up-to-date".
Release Notes:
- Changed dev extensions to be excluded from extension auto-updates.
This PR makes it so the icon of the shared screen tab is properly dimmed
when the tab is inactive.
Release Notes:
- Fixed an issue where the shared screen tab's icon would not render as
dimmed when the tab was inactive.
Co-Authored-By: Marshall <marshall@zed.dev>
Release Notes:
- Added a hint the first few times you open a multibuffer to explain
what is going on.
Co-authored-by: Marshall <marshall@zed.dev>
This adds the ability for Zed to restore unsaved buffers on restart. The
user is no longer prompted to save/discard/cancel when trying to close a
Zed window with dirty buffers in it. Instead those dirty buffers are
stored and restored on restart.
It does this by saving the contents of dirty buffers to the internal
SQLite database in which Zed stores other data too. On restart, if there
are dirty buffers in the database, they are restored.
On certain events (buffer changed, file saved, ...) Zed will serialize
these buffers, throttled to a 100ms, so that we don't overload the
machine by saving on every keystroke. When Zed quits, it waits until all
the buffers are serialized.
### Current limitations
- It does not persist undo-history (right now we don't persist/restore
undo-history regardless of dirty buffers or not)
- It does not restore buffers in windows without projects/worktrees.
Example: if you open a new window with `cmd-shift-n` and type something
in a buffer, this will _not_ be stored and you will be asked whether to
save/discard on quit. In the future, we want to fix this by also
restoring windows without projects/worktrees.
### Demo
https://github.com/user-attachments/assets/45c63237-8848-471f-8575-ac05496bba19
### Related tickets
I'm unsure about closing them, without also fixing the 2nd limitation:
restoring of worktree-less windows. So let's wait until that.
- https://github.com/zed-industries/zed/issues/4985
- https://github.com/zed-industries/zed/issues/4683
### Note on performance
- Serializing editing buffer (asynchronously on background thread) with
500k lines takes ~200ms on M3 Max. That's an extreme case and that
performance seems acceptable.
Release Notes:
- Added automatic restoring of unsaved buffers. Zed can now be closed
even if there are unsaved changes in buffers. One current limitation is
that this only works when having projects open, not single files or
empty windows with unsaved buffers. The feature can be turned off by
setting `{"session": {"restore_unsaved_buffers": false}}`.
---------
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>