This pull request replaces the static `⋯` character we used to insert
when folding a range with a custom render function that return an
`AnyElement`. We plan to use this in the assistant, but for now this
should be behavior-preserving.
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
Antonio Scandurra
,
Nathan
, and
Conrad
created
e0cfba4
gleam: Detect tests using `describe` API for Startest (#12221)
Click to expand commit body
This PR updates the Gleam runnables to detect tests using the `describe`
API in Startest.
This isn't entirely functional yet, as it is still just uses the test
function name to run the tests (which Startest doesn't yet support).
Release Notes:
- N/A
Marshall Bowers
created
e15b902
Fix double lease panic in Quote Selection command (#12217)
Click to expand commit body
Release Notes:
- Fixed a panic that occurred when using the `assistant: quote
selection` command while signed out.
Max Brunsfeld
created
9c35187
Fix line with invisibles positioning (#12211)
Click to expand commit body
Release Notes:
- fixed positioning of whitespace dots on multibyte text
([#10332](https://github.com/zed-industries/zed/issues/10332)).
Conrad Irwin
created
951fbc5
Fix `rustfmt` issues in `dev_servers.rs` (#12205)
Click to expand commit body
This PR fixes some issues preventing `rustfmt` from running properly in
`dev_servers.rs`.
The culprit was some long strings being inlined.
Release Notes:
- N/A
Marshall Bowers
created
e903742
indent guides: Cache active indent range (#12204)
Click to expand commit body
Caching the active indent range allows us to not re-compute the indent
range when it is not necessary
Release Notes:
- N/A
Builds on top of existing work from #2249, but here's a showcase:
https://github.com/zed-industries/zed/assets/53836821/4b346965-6654-496c-b379-75425d9b493f
TODO:
- [x] handle line wrapping
- [x] implement handling in multibuffer (crashes currently)
- [x] add configuration option
- [x] new theme properties? What colors to use?
- [x] Possibly support indents with different colors or background
colors
- [x] investigate edge cases (e.g. indent guides and folds continue on
empty lines even if the next indent is different)
- [x] add more tests (also test `find_active_indent_index`)
- [x] docs (will do in a follow up PR)
- [x] benchmark performance impact
Release Notes:
- Added indent guides
([#5373](https://github.com/zed-industries/zed/issues/5373))
---------
Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Remco <djsmits12@gmail.com>
Bennet Bo Fenner
,
Nate Butler
, and
Remco
created
3eb0418
Make a macro for less boilerplate when moving variables (#12182)
Click to expand commit body
Also:
- Simplify open listener implementation
- Add set_global API to global traits
Release Notes:
- N/A
ea166f0
Add a send button to the assistant (#12171)
Click to expand commit body

Include the keybinding to help people discover how to submit from the
keyboard.
I'm also shifting from the word "Conversation" to "Context".
Release Notes:
- Added a send button to the assistant panel.
This PR updates the Zig extension to pin ZLS to v0.11.0, as the more
recent releases of ZLS don't have `.tar.gz` assets available.
Note that this depends on the next version of the `zed_extension_api`,
which has yet to be released.
Release Notes:
- N/A
This PR adds a new `github_release_by_tag_name` method to the
`zed_extension_api` to allow for retrieving a GitHub release by its tag
name.
Release Notes:
- N/A
Marshall Bowers
created
85ff80f
Restrict v0.0.7 of the `zed_extension_api` to dev builds, for now (#12170)
Click to expand commit body
This PR restricts usage of v0.0.7 of the `zed_extension_api` to dev
builds, for now.
As we're still making changes to it, we don't want to ship a version of
Zed to Preview/Stable that claims to support a yet-unreleased version of
the extension API.
Release Notes:
- N/A
Marshall Bowers
created
80bd40c
zed_extension_api: Fork new version (#12160)
Click to expand commit body
This PR forks a new version of the `zed_extension_api` in preparation
for some upcoming changes that require breaking changes to the WIT.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
Marshall Bowers
and
Max
created
2564d5d
docs: Remove references to `language_overrides` (#12169)
Click to expand commit body
This PR replaces references to `language_overrides` in the docs with
just `languages`.
`language_overrides` is an alias for `languages`, and we want to move
towards just using `languages`.
Release Notes:
- N/A
Marshall Bowers
created
770a702
Write a randomized test and fix bugs in the logic for omitting slash commands from completion requests (#12164)
Restructure prompts & the prompt library.
- Prompts are now written in markdown
- The prompt manager has a picker and editable prompts
- Saving isn't wired up yet
- This also removes the "Insert active prompt" button as this concept doesn't exist anymore, and will be replaced with slash commands.
I didn't staff flag this, but if you do play around with it expect it to still be pretty rough.
Release Notes:
- N/A
---------
Co-authored-by: Nathan Sobo <1789+nathansobo@users.noreply.github.com>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Nate Butler
,
Nathan Sobo
, and
Antonio Scandurra
created
a73a3ef
Add slash commands for adding context into the assistant (#12102)
Click to expand commit body
Tasks
* [x] remove old flaps and output when editing a slash command
* [x] the completing a command name that takes args, insert a space to
prepare for typing an arg
* [x] always trigger completions when typing in a slash command
* [x] don't show line numbers
* [x] implement `prompt` command
* [x] `current-file` command
* [x] state gets corrupted on `duplicate line up` on a slash command
* [x] exclude slash command source from completion request
Next steps:
* show output token count in flap trailer
* add `/project` command that matches project ambient context
* delete ambient context
Release Notes:
- N/A
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Max Brunsfeld
,
Marshall
, and
Antonio Scandurra
created
This PR bumps the PHP extension to v0.0.4.
Changes:
- https://github.com/zed-industries/zed/pull/11514
Release Notes:
- N/A
Remco Smits
created
58796a8
tasks: Expose captured variables to ContextProvider (#12134)
Click to expand commit body
This PR changes the interface of ContextProvider, allowing it to inspect
*all* variables set so far during the process of building
`TaskVariables`. This makes it possible to capture e.g. an identifier in
tree-sitter query, process it and then export it as a task variable.
Notably, the list of variables includes captures prefixed with leading
underscore; they are removed after all calls to `build_context`, but it
makes it possible to capture something and then conditionally preserve
it (and perhaps modify it).
Release Notes:
- N/A
aa539fc
lsp: Fix wrong WorkspaceFolder when opening only file (#12129)
Click to expand commit body
This fixes #11361 and #8764 by making sure we pass a directory as
`WorkspaceFolder` to the language server.
We already compute the `working_dir` correctly when
`self.root_path.is_file()`, but we didn't use it.
Release Notes:
- Fixed language servers (such as `gopls`) not starting up correctly
when opening a single file in Zed.
([#11361](https://github.com/zed-industries/zed/issues/11361) and
[#8764](https://github.com/zed-industries/zed/issues/8764)).
Thorsten Ball
created
49dffab
macOS: Allow creating directories in file-open panel (#12121)
Click to expand commit body
I don't know whether there are any hard UI guidelines that dictate
whether this should be allowed or not, but I think it's very handy and
missed it.
I also think it makes sense to have this in a directory-centric editor
in which opening a directory creates a new window.
Release Notes:
- Added ability to create directory in open-file dialog on macOS.

When you press `V` to go into visual-line mode in Vim,
`selections.line_mode` is true and the selection contains _lines_.
But `$ZED_SELECTED_TEXT` always contained just the cursor location or
any non-line-mode selection that was previously made.
Release Notes:
- Fixed `$ZED_SELECTED_TEXT` variable in Tasks ignoring whether
visual-line-mode in Vim was used.
### This pull request adds the following:
- Missing mapping for the `yield` keyword.
- Outline scheme for `describe`, `it` and `test`
function_call_expressions (to support Pest runnable)
- Pest runnable support
- PHPUnit runnable support
- Task for running selected PHP code.
## Queries explanations
#### Query 1 (PHPUnit: Run specific method test):
1. Class is not abstract (because you cannot run tests from an abstract
class)
2. Class has `Test` suffix
3. Method has public modifier(or no modifiers, default is public)
4. Method has `test` prefix
#### Query 2 (PHPUnit: Run specific method test with `@test`
annotation):
1. Class is not abstract (because you cannot run tests from an abstract
class)
2. Class has `Test` suffix
3. Method has public modifier(or no modifiers, default is public)
4. Method has `@test` annotation
#### Query 3 (PHPUnit: Run specific method test with `#[Test]`
attribute):
1. Class is not abstract (because you cannot run tests from an abstract
class)
2. Class has `Test` suffix
3. Method has public modifier(or no modifiers, default is public)
4. Method has `#[Test]` attribute
#### Query 4 (PHPUnit: Run all tests inside the class):
1. Class is not abstract (because you cannot run tests from an abstract
class)
2. Class has `Test` suffix
#### Query 5 (Pest: Run function test)
1. Function expression has one of the following names: `describe`, `it`
or `test`
2. Function expression first argument is a string
### **PHPUnit: Example for valid test class**
<img width="549" alt="Screenshot 2024-05-08 at 10 41 34"
src="https://github.com/zed-industries/zed/assets/62463826/e84269de-4f53-410b-b93b-713f9448dc79">
### **PHPUnit: Example for invalid test class**
All the methods should be ignored because you cannot run tests on an
abstract class.
<img width="608" alt="Screenshot 2024-05-07 at 22 28 57"
src="https://github.com/zed-industries/zed/assets/62463826/8c6b3921-5266-4d88-ada5-5cd827bcf242">
### **Pest: Example**
https://github.com/zed-industries/zed/assets/62463826/bce133eb-0a6f-4ca2-9739-12d9169bb9d6
You should now see all your **Pest** tests inside the buffer symbols
modal.

Release Notes:
- Added test runnable detection for PHP (PHPUnit & Pest).
- Added task for running selected PHP code.
- Added `describe`, `test` and `it` functions to buffer symbols, to
support Pest runnable.
- Added `yield` keyword to PHP keyword mapping.
This adds support for runnables to Go.
It adds the following tasks:
- `go test $ZED_GO_PACKAGE -run $ZED_SYMBOL`
- `go test $ZED_GO_PACKAGE`
- `go test ./...`
- `go run $ZED_GO_PACKAGE` if it has a `main` function
Release Notes:
- Added built-in Go runnables and tasks that allow users to run Go test
functions, test packages, or run `main` functions.
Demo:
https://github.com/zed-industries/zed/assets/1185253/a6271d80-faf4-466a-bf63-efbec8fe6c35
https://github.com/zed-industries/zed/assets/1185253/92f2b616-7501-463d-b613-1ec1084ae0cd
Thorsten Ball
created
e5b9e20
Allow ssh connection for setting up zed (#12063)
3382e79
Improve file finder match results (#12103)
Kirill Bulatov
created
c290d92
Allow formatting of unsaved buffers with prettier (#12095)
Click to expand commit body
This fixes #4529 by allowing unsaved buffers to be formatted with
prettier.
Steps to do that:
1. Create a new buffer
2. Set language for the buffer (e.g.: `language selector: toggle` and
JSON)
3. In settings, set prettier parser for language (can't be inferred,
since we don't have filename) and allow formatting with prettier:
```json
{
"languages": {
"JSON": {
"prettier": {
"allowed": true,
"parser": "json"
}
}
}
}
```
4. Use `editor: format`
Release Notes:
- Added ability to format unsaved buffers with Prettier. Requirement is
to set a Prettier parser in the user settings. Example for JSON: `{
"languages": { "JSON": { "prettier": { "allowed": true, "parser": "json"
} } } }` ([#4529](https://github.com/zed-industries/zed/issues/4529)).
Demo:
https://github.com/zed-industries/zed/assets/1185253/d24e490b-2e2c-4a5d-95a8-fc8675523780
Thorsten Ball
created
b451af4
Fix `npm install` error with some languages (#12087)
Click to expand commit body
If you have already installed `node` using `brew install node`, you are
fine. If you did not install `node` on you local machine, it fails.
The `node_binary` path is actually not included in environment variable.
When run `npm install`, some extensions like `eslint`, may run some
commands like `sh -c node .....`. Since `node_binary` path is not
included in `PATH` variable, `sh -c node ...` will fail complaining that
"command not found". If you have installed `node` before, `node` is
already included in `PATH`, so you are fine. If not, it fails.
Closes #11890
Release Notes:
- Fixed Zed's internal Node runtime not being put in `$PATH` correctly
when running language servers and other commands with `node`.
([#11890](https://github.com/zed-industries/zed/issues/11890))
---------
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
This PR bumps the Ruby extension to v0.0.4.
Changes:
- #11869
- #12012
- #12052
Release Notes:
- N/A
Vitaly Slobodin
created
99570f9
ruby: Add support for running tests (#12052)
Click to expand commit body
Hello, this pull request adds two things related to each other. I hope
it's fine to submit both in the same pull request but I am totally fine
with submitting them in separate pull requests, just let me know. This
is an initial version for both features. Thanks!
## Symbols outline support for testing frameworks: minitest and RSPec
Symbols outline support in
[Minitest](https://github.com/minitest/minitest) (the testing framework
that comes with Ruby on Rails out of the box) and RSpec (another testing
framework that is popular in Ruby and Ruby on Rails world). Here are
some screenshots:
### Minitest
Given this Ruby code:
```ruby
require "test_helper"
class CategoryTest < ActiveSupport::TestCase
context "validations" do
subject { build(:category) }
should validate_presence_of(:title)
should validate_length_of(:title).is_at_most(255)
should validate_uniqueness_of(:title)
end
end
class TestNamesWithMiniTest < ActiveSupport::TestCase
def test_foo_1; assert true; end
def test_foo_2; assert true; end
def test_bar_1; assert true; end
def test_bar_2; assert true; end
end
```
We have this symbols outline:

### RSpec
I used `mastodon` application for testing because it's written in Ruby.
Given the following file
https://github.com/mastodon/mastodon/blob/main/spec/models/account_spec.rb
We have the following symbols outline:

## Running Ruby tests
### Minitest
Given the same file as above, we have the following workflow:
https://github.com/zed-industries/zed/assets/1894248/dc335495-3460-4a6d-95c4-e4cbc87a1ea0
### RSpec
Given the following file
`https://github.com/mastodon/mastodon/blob/main/spec/models/account_spec.rb`
We have the following workflow:
https://github.com/zed-industries/zed/assets/1894248/a17067ea-73b6-4229-8f1b-1b88dde63401
<hr />
Release Notes: Added Ruby test runnables support
Vitaly Slobodin
created
f371087
Introduce `Editor::insert_flaps` and `Editor::remove_flaps` (#12096)
Click to expand commit body
This pull request introduces the ability to add flaps, custom foldable
regions whose first foldable line can be associated with:
- A toggle in the gutter
- A trailer showed at the end of the line, before the inline blame
information
https://github.com/zed-industries/zed/assets/482957/c53a9148-f31a-4743-af64-18afa73c404c
To achieve this, we changed `FoldMap::fold` to accept a piece of text to
display when the range is folded. We use this capability in flaps to
avoid displaying the ellipsis character.
We want to use this new API in the assistant to fold context while still
giving visual cues as to what that context is.
Release Notes:
- N/A
---------
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Max <max@zed.dev>
Antonio Scandurra
,
Nathan Sobo
,
Mikayla
, and
Max
created
b89f360
lsp: Handle `client/unregisterCapability` to fix gopls (#12086)
Click to expand commit body
This fixes #10224 by handling `client/unregisterCapability` requests
that have a `workspace/didChangeWatchedFiles` method.
While debugging the issue, I found out that `gopls` seems to block
indefinitely when there's no reply to the `client/unregisterCapability`
request. Even an empty response would fix the issue.
Seems like gopls 15.x and later seem to handle nested subfolders well,
but do not handle unanswered requests.
Instead of replying with an empty response, I decided to change how we
handle file watching and keep a list of all registered paths so that we
can then unregister paths and recreate the glob patterns.
Release Notes:
- Fixed `gopls` not working correctly when the `go.mod` file was in a
subfolder and not the root folder of the project opened in Zed.
([#10224](https://github.com/zed-industries/zed/issues/10224)).
Add config for tag autoclosing: add following to lsp section of your
settings:
"vscode-html-language-server": {
"settings": {
"html": { "tagAutoclosing": true }
}
}
It also accepts `css`, `js/ts` and `javascript` as options.
Disable HTML language server in JS/TS/TSX files for now. I decided to
disable it for now as it caused excessive edits in these types of files
(as reported by @mariansimecek in
https://github.com/zed-industries/zed/pull/11761#issuecomment-2122038107);
it looks like HTML language server tries to track language ranges (e.g.
whether a particular span is TS/HTML fragment etc) just like we do.
However in plain JS/TSX files it seems like it treats the whole file as
one big chunk of HTML, which is.. not right, to say the least.
No release note, as HTML extension goodies are not on Preview yet.
Release Notes:
- N/A
This fixes #5304 by adding a new Duplicate action to the project panel
context menu.
It really is implemented on top of copy&paste.
Release Notes:
- Added a Duplicate action to the project panel.
([#5304](https://github.com/zed-industries/zed/issues/5304)).
https://github.com/zed-industries/zed/assets/1185253/f0fa6a4b-f066-47df-84f0-257a049800d1