Commit Graph

1123 Commits

Author SHA1 Message Date
Piotr Osiewicz
b6ea393d14
lsp: Add support for linked editing range edits (HTML tag autorenaming) (#12769)
This PR adds support for [linked editing of
ranges](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_linkedEditingRange),
which in short means that editing one part of a file can now change
related parts in that same file. Think of automatically renaming
HTML/TSX closing tags when the opening one is changed.
TODO:
- [x] proto changes
- [x] Allow disabling linked editing ranges on a per language basis.

Fixes #4535 

Release Notes:
- Added support for linked editing ranges LSP request. Editing opening
tags in HTML/TSX files (with vtsls) performs the same edit on the
closing tag as well (and vice versa). It can be turned off on a language-by-language basis with the following setting:
```
  "languages": {
    "HTML": {
      "linked_edits": true
    },
  }
```

---------

Co-authored-by: Bennet <bennet@zed.dev>
2024-06-11 15:52:38 +02:00
Antonio Scandurra
98659eabf1
Overhaul inline assistant (#12846)
This pull request introduces a new diff mechanism that helps users
understand exactly which lines were changed by the LLM.

Release Notes:

- N/A
2024-06-11 12:39:45 +02:00
Conrad Irwin
75f8be6a0f
vim: add guu gUU g~~ g/ (#12789)
Release Notes:

- vim: Add `g/` for project search
2024-06-07 16:45:38 -06:00
Conrad Irwin
5548773b2e
vim: Add gU/gu/g~ (#12782)
Co-Authored-By: ethanmsl@gmail.com

Release Notes:

- vim: Added `gu`/`gU`/`g~` for changing case. (#12565)
2024-06-07 12:38:12 -06:00
Antonio Scandurra
a0c0f1ebcd
Rename conversations to contexts (#12724)
This just changes nomenclature within the codebase and should have no
external effect.

Release Notes:

- N/A
2024-06-06 11:40:54 +02:00
Dhairya Nadapara
0b75afd322
chore: added inl to cpp config (#12710)
Screenshot:
<img width="1027" alt="image"
src="https://github.com/zed-industries/zed/assets/19250981/1d35d35c-d31c-4feb-b2ca-a417972fadf6">

Release Notes:

- Added `inl` to cpp config ([12605](https://github.com/zed-industries/zed/issues/12605))
2024-06-06 10:23:36 +03:00
Chung Wei Leong
b50846205c
Fixed default LSP default settings for JavaScript, TypeScript & TSX (#12716)
Fixed the default LSP settings for `JavaScript`, `TypeScript` & `TSX`,
correcting the "rest" value from `".."` to `"..."`.

Release Notes:
- N/A
2024-06-06 09:40:20 +03:00
Kirill Bulatov
a574036efd
Update the whitespace docs in the default settings file (#12717) 2024-06-06 08:29:01 +03:00
Conrad Irwin
89641acf2f
Fix ordering of keyboard shortcuts so that you can use AI on linux (#12714)
Release Notes:

- N/A
2024-06-05 21:58:37 -06:00
Nate Butler
611bf2d905
Update prompt library styles (#12689)
- Extend Picker to allow passing a custom editor. This allows creating a
custom styled input.
- Updates various picker styles

Before:

![CleanShot 2024-06-05 at 22 08
36@2x](https://github.com/zed-industries/zed/assets/1714999/96bc62c6-839d-405b-b030-31491aab8710)

After:

![CleanShot 2024-06-05 at 22 09
15@2x](https://github.com/zed-industries/zed/assets/1714999/a4938885-e825-4880-955e-f3f47c81e1e3)

Release Notes:

- N/A
2024-06-05 22:10:02 -04:00
kshokhin
c7c19609b3
Search in selections (#10831)
Release Notes:

- Adding [#8617 ](https://github.com/zed-industries/zed/issues/8617)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-05 13:42:51 -06:00
Owen Law
d6e271c956
Add note about auto-updating on Linux (#12662)
Release Notes:

- N/A
2024-06-04 19:13:08 -06:00
Paul Eguisier
8a659b0c60
Implement Indent & Outdent as operators (#12430)
Release Notes:

- Fixes [#9697](https://github.com/zed-industries/zed/issues/9697).

Implements `>` and `<` with motions and text objects.
Works with repeat action `.`
2024-06-04 15:17:01 -06:00
Antonio Scandurra
c5b22eee2d
Polish prompt library UX (#12647)
This could still use some improvement UI-wise but the user experience
should be a lot better.

- [x] Show in "Window" application menu
- [x] Load prompt as it's selected in the picker
- [x] Refocus picker on `esc`
- [x] When creating a new prompt, if a new prompt already exists and is
unedited, activate it instead
- [x] Add `/default` command
- [x] Evaluate /commands on prompt insertion
- [x] Autocomplete /commands (but don't evaluate) during prompt editing
- [x] Show token count using the settings model, right-aligned in the
editor
- [x] Picker 
- [x] Sorted alpha
- [x] 2 sublists
    - Default
        - Empty state: Star a prompt to add it to your default prompt
        - Otherwise show prompts with star on hover
    - All
        - Move prompts with star on hover

Release Notes:

- N/A
2024-06-04 18:36:54 +02:00
Marshall Bowers
c752763301
Remove default language settings that are provided by extensions (#12612)
This PR removes some default language settings that are now provided by
their respective extensions.

In #10296 we added the ability for the language configuration within
extensions to provide certain language settings (e.g., `tab_size`).

New versions of the extensions have been published that take advantage
of that and have been in circulation for over a month now. To that end,
we no longer need these settings provided as defaults.

Release Notes:

- N/A
2024-06-03 14:40:23 -04:00
Marshall Bowers
2f65c3c6e6
Disable vtsls by default (#12611)
This PR adds default settings to disable `vtsls` by default so that
there aren't multiple TypeScript language servers running.

I also renamed the language server from `vtsls-language-server` to just
`vtsls`, since the `-language-server` suffix was redundant.

Release Notes:

- N/A
2024-06-03 14:30:33 -04:00
apricotbucket28
959f0dcded
Fix terminal key bindings (#12558)
Fixes https://github.com/zed-industries/zed/issues/12556

Only changed the keymap on Linux since I'm not sure if the behaviour is
correct on macOS

Release Notes:

- N/A
2024-06-03 11:25:27 -07:00
xzbdmw
726f23e867
Add !vimwaiting to togglecomment (#12552)
Release Notes:
-Fixed #12483 
It turns out to be very simple. `fg` has conflict with `gc` mapping so
when you type g editor state is pending.
2024-06-03 17:23:29 +02:00
Nathan Sobo
5f98b9617a
Start on a database-backed prompt library (#12468)
Using the file system as a database seems like it's easy, but it's
actually a real pain. I'd like to use LMDB to store the prompts locally
so we have more control. We can always add an export option, but I want
the source of truth to be somewhere other than the file system.

So far, I have a PromptStore which is global to the application and can
be initialized on startup. Then there's a `PromptLibrary` which is
intended to be the root of a new kind of Zed window. I haven't actually
seen pixels yet, but I've sketched out the basics needed to create a new
prompt, save, etc.

Still lots to figure out but the foundations of being backed by a DB and
rendering in an independent window are in place.

/cc @iamnbutler @as-cii 

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-06-03 15:58:43 +02:00
Piotr Osiewicz
18e2b43d6d
task: Rebind UseSelectedQuery in modal to F2 (#12601)
Also fix click handler for "Rerun last task".

Fixes #12580
Release Notes:

- Fixed click handler for "rerun last task" in task modal not working.
- Rebound "picker::UseSelectedQuery" from `opt-E` to `F2`.
2024-06-03 12:52:44 +02:00
Mikayla Maki
94c3101fb0
Fix or promote leftover TODOs and GPUI APIs (#12514)
fixes https://github.com/zed-industries/zed/issues/11966

Release Notes:

- N/A
2024-05-31 18:36:15 -07:00
Marshall Bowers
7a30937e21
Sort file_types.json (#12487)
This PR sorts the `file_types.json` file alphabetically.

This is the command I used to sort it:

```
pnpm --package=json-sort-cli dlx jsonsort assets/icons/file_icons/file_types.json
```

Release Notes:

- N/A
2024-05-30 11:26:52 -04:00
Antonio Scandurra
6ff01b17ca
Improve model selection in the assistant (#12472)
https://github.com/zed-industries/zed/assets/482957/3b017850-b7b6-457a-9b2f-324d5533442e


Release Notes:

- Improved the UX for selecting a model in the assistant panel. You can
now switch model using just the keyboard by pressing `alt-m`. Also, when
switching models via the UI, settings will now be updated automatically.
2024-05-30 12:36:07 +02:00
Jason Lee
3c6c850390
task: Add re-run task button to terminal title (#12379)
Release Notes:

- Added re-run task button to terminal title.

Close #12277

## Demo


https://github.com/zed-industries/zed/assets/5518/4cd05fa5-4255-412b-8583-68e22f86561e

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
2024-05-29 11:40:43 +02:00
Marshall Bowers
82a57a121a
Disable calls.share_on_join by default (#12401)
This PR changes the default value of the `calls.share_on_join` setting
from `true` to `false`.

Nathan mentioned that project sharing should be opt-in so that projects
aren't shared unless you intend for them to be.

Release Notes:

- Changed the default `calls.share_on_join` value to `false`.
2024-05-28 19:28:07 -04:00
Piotr Osiewicz
016a1444a7
project panel: Allow selecting multiple entries & add support for multiselect actions (#12363)
Fixes #4983 
TODO:
- [x] Improve release note.
- [x] Tests

Release Notes:

- Project panel now supports selecting multiple entries via cmd-click
and shift-click/shift-up/shift-down.
- Added support for handling multiple selected project panel entries to
Cut, Copy, Trash and Delete actions.
2024-05-28 15:51:23 +02:00
Antonio Scandurra
7e3ab9acc9
Rework context insertion UX (#12360)
- Confirming a completion now runs the command immediately
- Hitting `enter` on a line with a command now runs it
- The output of commands gets folded away and replaced with a custom
placeholder
- Eliminated ambient context

<img width="1588" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/b1927a45-52d6-4634-acc9-2ee539c1d89a">

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-05-27 17:44:54 -06:00
Nate Butler
a6dd2ca694
Allow saving prompts from the Prompt Manager (#12359)
Adds the following features to the prompt manager:

- New prompt – Create a new prompt from the UI. It will only persist if
it is saved.
- Save prompt – Save a prompt by clicking the save button in the UI. A
keybinding will be added for this in the future.
- Reveal prompt - Show the selected prompt on the file system. Only
available for saved prompts.

New prompts that are saved will use the
`{slugified_title}_{ver}_{id}.md` format which all imported prompts will
move to in the near future.

Also orders prompts in alphabetical order by default.

Release Notes:

- N/A
2024-05-27 13:48:21 -04:00
Nathan Sobo
e19339bc1d
Allow UI font weight to be assigned in settings (#12333)
Release Notes:

- Added the ability to configure the weight of your UI font in standard
CSS weight units from 0 to 900.
2024-05-26 23:06:58 -06:00
Mikayla Maki
a9e3d4ec4e
Improve context expansion (#10957)
Release Notes:

- Improved expand excerpt indicators to allow unidirectional expansion.
Also added the `editor::ExpandExcerptsUp` and
`editor::ExpandExcerptsDown` actions, which can both take a `lines`
parameter. Also added a `expand_excerpt_lines` setting which controls
the default number of lines that the indicators and actions use.

---------

Co-authored-by: conrad <conrad@zed.dev>
2024-05-26 16:30:09 -07:00
Kirill Bulatov
df35fd0026
Show Delete shortcuts in project panel context menu (#12250)
Closes https://github.com/zed-industries/zed/issues/12234 by making both
default keymap and the menu `Delete` action declarations to have the
same `skip_prompt` value.
`Trash` action got more explicit `skip_prompt` declarations in this PR,
but those were the defaults already, so not changed.

Now, `Delete` action in the project panel will always show a prompt
before removing, both on the keystroke and menu item click.
To note, VSCode does skips prompt for the `Trash` action, so we might
want to change that too (later?), the PR does not alter it.

Release Notes:

- Shows Delete action binding keys in the project panel context menu
([12234](https://github.com/zed-industries/zed/issues/12234))
2024-05-24 22:02:21 +03:00
Congyu
b0d89d6f34
Fix jetbrains keymap alt-enter to do search::SelectAllMatches (#11951)
The default keymap uses alt-enter for `SelectAllMatches` for `context:
BufferSearchBar`.

Jetbrains keymap uses alt-enter for `ToggleCodeActions` for `context:
Editor`.

When focusing on search bar, currently alt-enter does not perform
`SelectAllMatches`, whereas `ToggleCodeActions` is triggered instead,
because search bar's text input element has `context: Editor
mode=single_line`.

This PR restricts `ToggleCodeActions` to `Editor (full mode)` context to
allow `SelectAllMatches` to be triggered for alt-enter when the search
bar is active.

Release Notes:

- Fixed alt-enter with JetBrains keymap ignoring `search::SelectAllMatches` in certain contexts ([11840](https://github.com/zed-industries/zed/issues/11840))
2024-05-24 12:47:38 +03:00
Conrad Irwin
656edc4b2e
Vim smorgasbord (#12222)
Release Notes:

- vim: Added `]d/[d` for go to prev/next diagnostic
- vim: Added `]c/[c` to go to prev/next git change (`:diff` and
`:revert` show the diff and revert it)
- vim: Added `g cmd-d` for go to implementation
2024-05-23 21:09:32 -06:00
Bennet Bo Fenner
feea607bac
Indent guides (#11503)
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>
2024-05-23 15:50:59 +02:00
Nathan Sobo
ea166f0b27
Add a send button to the assistant (#12171)
![CleanShot 2024-05-22 at 18 20
45@2x](https://github.com/zed-industries/zed/assets/1789/dac9fcde-9fcb-4c40-b5da-ebdc847b3962)

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.
2024-05-22 19:17:28 -06:00
Joseph T. Lyons
d6e59bfae1
Fix proxy setting documentation (#12151)
Release Notes:

- N/A
2024-05-22 16:35:44 -04:00
Conrad Irwin
c2f650fe49
Fix some edge-cases in vim visual delete (#12131)
Release Notes:

- vim: Fixed `shift-d` in visual and visual block mode.
2024-05-22 12:54:41 -06:00
Raphael Lüthy
e68ef944d9
Separate actions for accepting the inline suggestions and completions (#12094)
Release Notes:
- Added `editor::AcceptInlineCompletion` action (bound to Tab by
default) for accepting inline completions. ([6788](https://github.com/zed-industries/zed/issues/6788))

---------

Signed-off-by: Raphael Lüthy <raphael.luethy@fhnw.ch>
Co-authored-by: Conrad Irvin <conrad@zed.dev>
2024-05-22 13:51:21 +03:00
Anıl Şenay
ba1d28f160
Add .gql and .graphqls extensions for GraphQL icon (#12073)
There are `.gql` and `.graphqls` suffix support in [GraphQL VSCode
extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql-syntax).
I use those file extensions in my projects, hence I wanted them to be
graphql icons.

Release Notes:

- Added GraphQL icon for `.gql` and `.graphqls` files.

currently:

![resim](https://github.com/zed-industries/zed/assets/1047345/4c333129-00cc-401a-88e6-fd44f74caea3)

after this pr:

![resim](https://github.com/zed-industries/zed/assets/1047345/103a0b5a-1c8b-4dea-998c-e768940887c4)

in vscode:

![resim](https://github.com/zed-industries/zed/assets/1047345/29f438d6-ff9e-4a95-8ef2-e5d8d27c0fe9)
2024-05-20 21:47:34 -04:00
Nipun Shukla
4e935f9f0f
Remove F2 keybind for Rename on MacOS and Linux (#12037)
Fix [#11608](https://github.com/zed-industries/zed/issues/11608)

Release Notes:

- Changed rename keybind from F2 to Enter in right-click context menu
([#11608](https://github.com/zed-industries/zed/issues/11608)).

![image](https://github.com/zed-industries/zed/assets/30131536/5ebdbb04-ff4e-46ff-80fb-9e95b2b3d285)
2024-05-20 10:35:22 +03:00
Conrad Irwin
1f611a9c90
Allow copy-pasting dev-server-token (#11992)
Release Notes:

- N/A
2024-05-17 16:41:46 -06:00
Mikayla Maki
11c97a396e
Implement 'Cmd+W with no open tabs closes the window', with a setting (#11989)
Follow up to: https://github.com/zed-industries/zed/pull/10986

However, I have set this to have a default behavior of 'auto': matching
the current platform's conventions, rather than a default value of
'off'.

fixes https://github.com/zed-industries/zed/issues/5322.

Release Notes:

- Changed the behavior of `workspace::CloseActiveItem`: when you're
using macOS and there are no open tabs, it now closes the window
([#5322](https://github.com/zed-industries/zed/issues/5322)). This can
be controlled with a new setting, `when_closing_with_no_tabs`, to
disable it on macOS, or enable it on other platforms.
2024-05-17 12:31:12 -07:00
Kuppjaerk
64ba08cced
Add documentation for auto-switching theme (#11908)
Added documentation regarding auto-switching themes to the default
settings file, according to
([#9627](https://github.com/zed-industries/zed/issues/9627)).

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-17 13:29:59 -04:00
Marshall Bowers
b93e564a78
Format default settings (#11985)
This PR formats `default.json`, as it had gotten out-of-sync with
Prettier.

Release Notes:

- N/A
2024-05-17 13:13:58 -04:00
Marshall Bowers
b9ecca7524
Remove wiring for assistant2 (#11940)
This PR removes the wiring for `assistant2` that hooks it up to Zed.

Since we're focusing in on improving the current assistant, we don't
need this present in Zed.

I left the `assistant2` crate intact for now, to make it easier to
reference any code from it.

Release Notes:

- N/A
2024-05-16 18:32:53 -04:00
Nate Butler
f8672289fc
Add prompt library (#11910)
This PR adds a Prompt Library to Zed, powering custom prompts and any
default prompts we want to package with the assistant.

These are useful for:

- Creating a "default prompt" - a super prompt that includes a
collection of things you want the assistant to know in every
conversation.
- Adding single prompts to your current context to help guide the
assistant's responses.
- (In the future) dynamically adding certain prompts to the assistant
based on the current context, such as the presence of Rust code or a
specific async runtime you want to work with.

These will also be useful for populating the assistant actions typeahead
we plan to build in the near future.

## Prompt Library

The prompt library is a registry of prompts. Initially by default when
opening the assistant, the prompt manager will load any custom prompts
present in your `~/.config/zed/prompts` directory.

Checked prompts are included in your "default prompt", which can be
inserted into the assitant by running `assistant: insert default prompt`
or clicking the `Insert Default Prompt` button in the assistant panel's
more menu.

When the app starts, no prompts are set to default. You can add prompts
to the default by checking them in the Prompt Library.

I plan to improve this UX in the future, allowing your default prompts
to be remembered, and allowing creating, editing and exporting prompts
from the Library.

### Creating a custom prompt

Prompts have a simple format:

```json
{
  // ~/.config/zed/prompts/no-comments.json
  "title": "No comments in code",
  "version": "1.0",
  "author": "Nate Butler <iamnbutler@gmail.com>",
  "languages": ["*"],
  "prompt": "Do not add inline or doc comments to any returned code. Avoid removing existing comments unless they are no longer accurate due to changes in the code."
}
```

Ensure you properly escape your prompt string when creating a new prompt
file.

Example:

```json
{
  // ...
  "prompt": "This project using the gpui crate as it's UI framework for building UI in Rust. When working in Rust files with gpui components, import it's dependencies using `use gpui::{*, prelude::*}`.\n\nWhen a struct has a `#[derive(IntoElement)]` attribute, it is a UI component that must implement `RenderOnce`. Example:\n\n```rust\n#[derive(IntoElement)]\nstruct MyComponent {\n    id: ElementId,\n}\n\nimpl MyComponent {\n    pub fn new(id: impl Into<ElementId>) -> Self {\n        Self { id.into() }\n    }\n}\n\nimpl RenderOnce for MyComponent {\n    fn render(self, cx: &mut WindowContext) -> impl IntoElement {\n        div().id(self.id.clone()).child(text(\"Hello, world!\"))\n    }\n}\n```"
}
```


Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-16 16:55:54 -04:00
张小白
1b261608c6
Add basic proxy settings (#11852)
Adding `proxy` keyword to configure proxy while using zed. After setting
the proxy, restart Zed to acctually use the proxy.

Example setting: 
```rust
"proxy" = "socks5://localhost:10808"
"proxy" = "http://127.0.0.1:10809"
```

Closes #9424, closes #9422, closes #8650, closes #5032, closes #6701,
closes #11890

Release Notes:

- Added settings to configure proxy in Zed

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-05-16 19:43:26 +03:00
Jason Lee
8c8c1769c7
docs: Fix quote in default.json (#11900)
Release Notes:

- N/A
2024-05-16 12:46:08 +02:00
Kirill Bulatov
cb430fc3e4
Autodetect parser name with prettier by default (#11558)
Closes https://github.com/zed-industries/zed/issues/11517 

* Removes forced prettier parser name for languages, making `auto`
command to run prettier on every file by default.
* Moves prettier configs away from plugin language declarations into
language settings

Release Notes:

- N/A
2024-05-15 22:51:46 +03:00
Thomas Aunvik
0ae0b08c38
linux: Add Keybinds Ctrl-Insert to Copy and Shift-Insert to Paste (#11799)
Release Notes:

- N/A
2024-05-14 12:03:21 -07:00
Antonio Scandurra
a13a92fbbf
Introduce recent files ambient context for assistant (#11791)
<img width="1637" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/5aaec657-3499-42c9-9528-c83728f2a7a1">

Release Notes:

- Added a new ambient context feature that allows showing the model up
to three buffers (along with their diagnostics) that the user interacted
with recently.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-05-14 13:48:36 +02:00
Piotr Osiewicz
95e0d5ed74
tasks: Reorganize task modal (#11752)
![image](https://github.com/zed-industries/zed/assets/24362066/bc7cc3d3-d9fc-4be6-b9b6-e3d8edf5b533)

Release Notes:
- Improved tasks modal by highlighting a distinction between a task
template and concrete task instance and surfacing available keybindings
more prominently. Task templates are now always available in the modal,
even if there's already a history entry with the same label.
- Changed default key binding for "picker::UseSelectedQuery" to `opt-e`.
2024-05-14 11:22:09 +02:00
Toon Willems
9b74acc4f5
Add GPT-4o as possible model (#11764)
Resolves: #11766

Release Notes:

- Add GPT-4o support (see: https://openai.com/index/hello-gpt-4o/).
GPT-4o is better and faster than 4-turbo, at half the price.
2024-05-14 10:43:24 +02:00
Vitaly Slobodin
24cc4c69f8
ruby: Add ruby-lsp as an experimental language server (#11768)
Adds [ruby-lsp](https://shopify.github.io/ruby-lsp/) as an alternative
LS for Ruby language.
While support for fully functional `ruby-lsp` is limited due to some
limitations (see https://github.com/zed-industries/zed/pull/8613) I
think it's OK to add it but disable by default. Thanks!

Resolves #4834.

Release Notes:

- N/A

### Some screenshots

Completion support
![CleanShot 2024-05-13 at 22 58
23@2x](https://github.com/zed-industries/zed/assets/1894248/d5047baa-c58f-465d-ae31-a7045aa56adf)

Symbol search
![CleanShot 2024-05-13 at 23 03
59@2x](https://github.com/zed-industries/zed/assets/1894248/0cb6320a-b000-4a0c-85eb-f8d1a8f6936e)

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-13 17:22:01 -04:00
Andrew Lygin
8e92f19fed
editor: Current line highlight options (#11710)
None:

<img width="717" alt="none"
src="https://github.com/zed-industries/zed/assets/2101250/b2a741db-c64a-4275-a612-5a0d15c9cab7">

Gutter:

<img width="715" alt="gutter"
src="https://github.com/zed-industries/zed/assets/2101250/f7a68a6e-6eba-41b4-9042-5a5fe2ee21a4">

Line:

<img width="717" alt="line"
src="https://github.com/zed-industries/zed/assets/2101250/117f5b00-abd7-425b-8047-1a6fab8293a7">

All:

<img width="715" alt="all"
src="https://github.com/zed-industries/zed/assets/2101250/ebccc0da-0fa0-44e5-903c-cc49d975db76">

This PR adds the `current_line_highlight` setting that defines how to
highlight the current line in the editor:

- `none`: Don't highlight the current line.
- `gutter`: Highlight the gutter area only.
- `line`: Highlight the editor area only.
- `all` (default): Highlight the whole line.

The options have been borrowed from VSCode.

Fixes #5222
Part of #4382

Release Notes:

- Added the `current_line_highlight` setting that defines how to
highlight the current line in the editor (#5222).
2024-05-13 22:02:12 +03:00
João Miguel Nogueira
78f1482cd1
Add autosave with delay (#11325)
Implemented autosave functionality with a delay, which now refrains from
formatting the code upon triggering unless the user manually saves it.
Additionally, enhanced documentation for the `format_on_save` setting
has been added. This resolves the issue where autosave with delay would
inadvertently format the code, disrupting the user experience, as
reported in the corresponding issue.

Release Notes:

- Fixed a bug where autosave after_delay would auto-format the buffer
([#9787](https://github.com/zed-industries/zed/issues/9787)).

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-05-12 17:18:30 -04:00
Robert Falkén
80d3eafa30
Alternate files with ctrl-6 (#11367)
This is my stab at #7709 

I realize the code is flawed. There's no test coverage, I'm using
`clone()` and there are probably better ways to hook into the events.
Also, I didn't know what context to use for the keybinding. But maybe
with some pointers from someone who actually know what they're doing, I
can get this shippable.

Release Notes:

- vim: Added ctrl-6 for
[alternate-file](https://vimhelp.org/editing.txt.html#CTRL-%5E) to
navigate back and forth between two buffers.



https://github.com/zed-industries/zed/assets/261929/2d10494e-5668-4988-b7b4-417c922d6c61

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-05-10 11:40:08 -06:00
Vitaly Slobodin
400e938997
Extract Ruby extension (#11360)
This PR extracts Ruby and ERB support into an extension and removes the
built-in Ruby and Ruby support from Zed.

As part of this, the new extension is prepared for adding support for
the `Ruby LSP` which has some blockers. See
https://github.com/zed-industries/zed/pull/8613 I was thinking of adding
an initial support for Ruby LSP but I think it would be better to start
with extracting the Ruby extension for now.

The implementation, as the 1st step, matches the bundled version but
with 3 differences:

1. Added signature output to the completion popup. See my comment below.
![CleanShot 2024-05-04 at 09 17
37@2x](https://github.com/zed-industries/zed/assets/1894248/486b7a48-ea0c-44ce-b0c9-9f8f5d3ad42d)

3. Use the shell environment for starting the `solargraph` executable.
See my comment below.
4. Bumped the tree sitter version for Ruby to the latest available
version.

Additionally, I plan to tweak this extension a bit in the future but I
think we should do this bit by bit. Thanks!

Release Notes:

- Removed built-in support for Ruby, in favor of making it available as
an extension.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-10 11:53:11 -04:00
Conrad Irwin
45f12b9426
vim cl (#11641)
Release Notes:

- vim: Added support for the changelist. `g;` and `g,` to the
previous/next change
- vim: Added support for the `'.` mark
- vim: Added support for `gi` to resume the previous insert
2024-05-09 21:18:56 -06:00
Zachiah Sawyer
901cb8b3d2
vim: Add basic mark support (#11507)
Release Notes:
- vim: Added support for buffer-local marks (`'a-'z`) and some builtin
marks `'<`,`'>`,`'[`,`']`, `'{`, `'}` and `^`. Global marks (`'A-'Z`),
and other builtin marks (`'0-'9`, `'(`, `')`, `''`, `'.`, `'"`) are not
yet implemented. (#5122)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-05-09 18:51:19 -06:00
Marshall Bowers
adecbd1815
Make Markdown default to "format_on_save": "off" (#11584)
This PR changes the Markdown language defaults to set `format_on_save`
to be `off`.

Prettier's Markdown formatting is a bit controversial for some people,
so we turn it off by default.

To restore the previous behavior, add the following to your settings:

```json
{
  "languages": {
    "Markdown": {
      "format_on_save": "on"
    }
  }
}
```


Release Notes:

- Changed the default `format_on_save` behavior for Markdown files to be
`off`.
2024-05-08 18:44:21 -04:00
Andrew Lygin
0933426e63
Editor tab bar settings (#7356)
This PR is another step to tabless editing (#6424, #4963). It adds
support for tab bar settings that allow the user to change its placement
or to hide completely.

Configuraton:

```json
"tab_bar": {
  "show": true
}
```

Placemnet options are "top", "bottom" and "no".

This PR intentionally doesn't affect tab bars of other panes (Terminal
for instance) to keep code changes small. I guess we'll do the rest in
separate PRs.

Release Notes:

- Added support for configuring the editor tab bar (part of #6424,
#4963).

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-05-08 10:54:48 -07:00
Owen Law
47c12c6563
Make prefer_line the default soft-wrap behavior. (#11542)
Stops lines from clipping at 1024 by default, returning it to the old
default behaviour where it wraps at 512. The `none` mode is only
supposed to be used for git hunks. See
https://github.com/zed-industries/zed/issues/11518#issuecomment-2099836283.

Release Notes:

- N/A
2024-05-08 13:14:48 +03:00
Nate Butler
47ca343803
Add DecoratedIcon (#11512)
This allows us to create icons with dynamic decorations drawn on top
like these:


![image](https://github.com/zed-industries/zed/assets/1714999/1d1a22df-8f90-47f2-abbd-ed7afa8fc641)

### Examples:

```rust
div()
    .child(DecoratedIcon::new(
        Icon::new(IconName::Bell).color(Color::Muted),
        IconDecoration::IndicatorDot,
    ))
    .child(
        DecoratedIcon::new(Icon::new(IconName::Bell), IconDecoration::IndicatorDot)
            .decoration_color(Color::Accent),
    )
    .child(DecoratedIcon::new(
        Icon::new(IconName::Bell).color(Color::Muted),
        IconDecoration::Strikethrough,
    ))
    .child(
        DecoratedIcon::new(Icon::new(IconName::Bell), IconDecoration::X)
            .decoration_color(Color::Error),
    )
```

Release Notes:

- N/A
2024-05-07 16:36:13 -04:00
Conrad Irwin
96a3021b12
vim: Add shift-k as alias for g h (#11463)
Co-Authored-By: Zachiah Sawyer <zachiah@proton.me>

Release Notes:

- vim: Added `shift-k` to show the hover tooltip

Co-authored-by: Zachiah Sawyer <zachiah@proton.me>
2024-05-06 16:05:19 -06:00
Kyle Kelley
6563330239
Supermaven (#10788)
Adds a supermaven provider for completions. There are various other
refactors amidst this branch, primarily to make copilot no longer a
dependency of project as well as show LSP Logs for global LSPs like
copilot properly.

This feature is not enabled by default. We're going to seek to refine it
in the coming weeks.

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-05-03 12:50:42 -07:00
Dom Christie
f252d9cf67
Fix alt-shift-(left|right) behaviour (#11292)
Not sure what the etiquette is here, but in the interest of fixing
#10242, I've re-implemented @jish's PR
https://github.com/zed-industries/zed/pull/10535 and have signed the CLA


Release Notes:

- Fixed `alt-shift-left` and `alt-shift-right` in the Textmate default
keybindings.
([#10242](https://github.com/zed-industries/zed/issues/10242))

TextMate keymap uses default option shift arrow selection
2024-05-03 11:29:47 +02:00
Nate Butler
78a8a58ee2
Iterate on Assistant 2 composer UI (#11306)
- Change project index tool rendering in composer
- Update composer UI style

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-05-02 13:01:21 -04:00
Kirill Bulatov
caa0d35b8b
Allow to toggle git hunk diffs (#11080)
Part of https://github.com/zed-industries/zed/issues/4523

Added two new actions with the default keybindings

```
"cmd-'": "editor::ToggleHunkDiff",
"cmd-\"": "editor::ExpandAllHunkDiffs",
```

that allow to browse git hunk diffs in Zed:


https://github.com/zed-industries/zed/assets/2690773/9a8a7d10-ed06-4960-b4ee-fe28fc5c4768


The hunks are dynamic and alter on user folds and modifications, or
toggle hidden, if the modifications were not adjacent to the expanded
hunk.


Release Notes:

- Added `editor::ToggleHunkDiff` (`cmd-'`) and
`editor::ExpandAllHunkDiffs` (`cmd-"`) actions to browse git hunk diffs
in Zed
2024-05-01 22:47:36 +03:00
Nate Butler
779f67506a
Assistant 2 temp icon (#11257)
Release Notes:

- N/A
2024-05-01 12:56:27 -04:00
Marshall Bowers
c9778a36ff
Use Elixir LS as the default language server for Elixir (#11234)
This PR adds `language_servers` settings for Elixir and HEEX to ensure
they both only use Elixir LS by default.

Eventually we'd like to have these provided by the Elixir extension, but
there are some outstanding questions on the design.

For now we can just use the built-in default settings to ensure a good
out-of-the-box experience for Elixir users.

Release Notes:

- N/A
2024-04-30 19:28:27 -04:00
Marshall Bowers
e8ee0131f1
Remove unused assistant prompt (#11221)
This PR removes an unused assistant prompt.

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-04-30 15:32:11 -04:00
Hans
4fad96b179
Add yss operation support for vim surrounds: (#11084)
The Motion::CurrentLine operation will contain the newline of the
current line, so we need to deal with this edge case



Release Notes:

- N/A
2024-04-29 19:38:14 -06:00
Bennet Bo Fenner
20625e98ad
preview tabs: Allow replacing preview tab when using code navigation (#10730)
This PR adds support for replacing the current preview tab when using
GoToDefinition. Previously a tab, that was navigated away from, was
converted into a permanent tab and the new tab was opened as preview.

Without `enable_preview_from_code_navigation`:


https://github.com/zed-industries/zed/assets/53836821/99840724-d6ff-4738-a9c4-ee71a0001634

With `enable_preview_from_code_navigation`:


https://github.com/zed-industries/zed/assets/53836821/8c60efcb-d597-40bf-b08b-13faf5a289b6

Note: In the future I would like to improve support for the navigation
history, because right now tabs that are not "normal" project items,
e.g. FindAllReferences cannot be reopened

Release Notes:

- Added support for replacing the current preview tab when using code
navigation (`enable_preview_from_code_navigation`)
2024-04-29 20:47:01 +02:00
Joseph T. Lyons
d4ec68b9ab
Add hpp file icon (#11149)
Release Notes:

- Added `.hpp` file icon.
2024-04-29 01:08:59 -04:00
Marshall Bowers
8b55494351
Properly register new icons (#11132)
This PR fixes some issues with the icons added in #11116, where they
weren't being registered properly.

Release Notes:

- N/A
2024-04-28 10:43:10 -04:00
Derek Briggs
32e6424543
Icons for js, c, cc, h, jsx, and tsx file types (#11116)
Release Notes:
Add Icons for react (jsx/tsx), C, and C++ files

![CleanShot 2024-04-27 at 21 06
26@2x](https://github.com/zed-industries/zed/assets/1648941/3f23c058-e0c1-4aed-bfdd-0a1a9c8d7203)

Release Notes:

- Added icons for JS, React, C, and C++
2024-04-27 21:24:54 -06:00
Mikayla Maki
d2569afe66
Switch from delete file by default to trash file by default (#10875)
TODO:

- [x] Don't immediately seg fault
- [x] Implement for directories 
- [x] Add cmd-delete to remove files
- [ ] ~~Add setting for trash vs. delete~~ You can just use keybindings
to change the behavior.

fixes https://github.com/zed-industries/zed/issues/7228
fixes https://github.com/zed-industries/zed/issues/5094

Release Notes:

- Added a new `project_panel::Trash` action and changed the default
behavior for `backspace` and `delete` in the project panel to send a
file to the systems trash, instead of permanently deleting it
([#7228](https://github.com/zed-industries/zed/issues/7228),
[#5094](https://github.com/zed-industries/zed/issues/5094)). The
original behavior can be restored by adding the following section to
your keybindings:

```json5
[
// ...Other keybindings...
  {
    "context": "ProjectPanel",
    "bindings": {
        "backspace": "project_panel::Delete",
        "delete": "project_panel::Delete",
    }
  }
]
2024-04-26 17:43:50 -07:00
blufony
5dbd23f6b0
vim: add keybinding to jump to parent directory in project panel (#11078)
Release Notes:

- vim: Support `-` to go to `parent directory` of the project panel.

As mentioned in the comments of #11073 this adds support for netrw's `-`
to go to the parent directory in the project panel. Again tested on
linux only.


- N/A
2024-04-26 18:22:15 -06:00
Andrew Lygin
1aa9c868d4
Scrollbar markers for cursors (#10816)
How it looks:

https://github.com/zed-industries/zed/assets/2101250/f564111c-1019-4442-b8a6-de338e12b12e

This PR adds cursor markers to the scrollbar. They work similar to
VSCode:

1. A cursor marker takes the whole scrollbar width.
2. It's always 2px high.
3. It uses the player's `cursor` color, so it may be helpful in the
collaboration mode.

There's a setting to switch cursor markers on/off:

```json
{
  "scrollbar": {
    "cursors": true
  }
}
```

Implementation details:

- Unlike other markers, cursor markers are displayed synchronously.
Otherwise they don't feel smooth and sometimes freez on prolonged
up/down navigation.
- Cursor markers are automatically switched off when it's more than 100
of them.
- The minimum (non-cursor) marker height is now 5px. It allows the user
to see other markers under the cursor marker.
- The way the minimum height is imposed on markers has changed a bit to
keep consistency between markers of different types.
- Selected symbol markers use less vibrant color (`info` faded out a
little).

Release Notes:

- Added displaying of cursor markers in the scrollbar. They can be
switched on/off by the `scrollbar.cursors` setting.
2024-04-27 02:26:42 +03:00
blufony
adcaa211ec
Add keybindings to jump to first / last file in project panel (#11073)
Release Notes:
- vim: Support `g g`/`G` to go to top/bottom of the project panel.

In vim type environments i usually expect to be able to jump to the top
and bottom and i was confused as to why that wasn't possible in the
project panel. So i added it. If anyone using different keymaps also
thinks this might be useful i would be happy to add other defaults. I
think for vim mode it is the most useful though, because you tend to not
use your mouse in vim mode.

This is my first contribution to any rust project, but it seemed like a
good starting point.
The function select_last() is inspired by select_first.
I was also thinking about adding a bigger jump keybinding, that would
jump for example 5 entries up / down, with vim default keybindings "{" /
"}".
FYI: I tested this on linux only and don't have access to any macos
machines.


- N/A
2024-04-26 16:35:57 -06:00
Michael Angerman
4c780568bc
storybook: Fix Backspace in Auto Height Editor and Picker stories (#11011)
Currently in the *Auto Height Editor* story the backspace key is not
working when you type into the Editor.

The same thing is true for the *Picker* story as one is not able to
backspace...

By adding an entry in the keymap file

```rust
assets/keymaps/storybook.json
```

both of these issues are solved...

Release Notes:

- N/A
2024-04-25 17:37:47 -04:00
Marshall Bowers
544bd490ac
Extract Elixir extension (#10948)
This PR extracts Elixir support into an extension and removes the
built-in Elixir support from Zed.

As part of this, [Lexical](https://github.com/lexical-lsp/lexical) has
been added as an available language server for Elixir.

Since the Elixir extension provides three different language servers,
you'll need to use the `language_servers` setting to select the one you
want to use:

#### Elixir LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "elixir-ls", "!next-ls", "!lexical", "..."]
    }
  }
}
```

#### Next LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "next-ls", "!elixir-ls", "!lexical", "..."]
    }
  }
}
```

#### Lexical

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "lexical", "!elixir-ls", "!next-ls", "..."]
    }
  }
}
```

These can either go in your user settings or your project settings.

Release Notes:

- Removed built-in support for Elixir, in favor of making it available
as an extension.
2024-04-25 13:59:14 -04:00
Antonio Scandurra
530224527d
Allow pressing escape to cancel the current assistant generation (#10987)
If the assistant has already emitted some text, we will leave the
assistant message but maintain the cursor on the previous user message,
so that the user can easily discard the message by submitting again.

If no output was emitted yet, we simply delete the empty assistant
message.

Release Notes:

- N/A
2024-04-25 15:12:58 +02:00
Thorsten Ball
bb213b6e37
Fix keybinding errors on Linux (#10982)
These showed up as error messages. One of them has been removed and the
other two have changed names.



Release Notes:

- N/A
2024-04-25 13:44:24 +02:00
Marshall Bowers
25981550d5
Extract Deno extension (#10912)
This PR extracts Deno support into an extension and removes the built-in
Deno support from Zed.

When using the Deno extension, you'll want to add the following to your
settings to disable the built-in TypeScript and ESLint language servers
so that they don't conflict with Deno's functionality:

```json
{
  "languages": {
    "TypeScript": {
      "language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
    },
    "TSX": {
      "language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
    }
  }
}

```

Release Notes:

- Removed built-in support for Deno, in favor of making it available as
an extension.
2024-04-23 20:44:11 -04:00
Marshall Bowers
cf67fc9055
Add language_servers setting for customizing which language servers run (#10911)
This PR adds a new `language_servers` setting underneath the language
settings.


This setting controls which of the available language servers for a
given language will run.

The `language_servers` setting is an array of strings. Each item in the
array must be either:

- A language server ID (e.g., `"rust-analyzer"`,
`"typescript-language-server"`, `"eslint"`, etc.) denoting a language
server that should be enabled.
- A language server ID prefixed with a `!` (e.g., `"!rust-analyzer"`,
`"!typescript-language-server"`, `"!eslint"`, etc.) denoting a language
server that should be disabled.
- A `"..."` placeholder, which will be replaced by the remaining
available language servers that haven't already been mentioned in the
array.

For example, to enable the Biome language server in place of the default
TypeScript language server, you would add the following to your
settings:

```json
{
  "languages": {
    "TypeScript": {
      "language_servers": ["biome", "!typescript-language-server", "..."]
    }
  }
}
```

More details can be found in #10906.

Release Notes:

- Added `language_servers` setting to language settings for customizing
which language server(s) run for a given language.
2024-04-23 19:38:57 -04:00
Kyle Kelley
68a1ad89bb
New revision of the Assistant Panel (#10870)
This is a crate only addition of a new version of the AssistantPanel.
We'll be putting this behind a feature flag while we iron out the new
experience.

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Conrad Irwin <conrad@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
Co-authored-by: Nate Butler <nate@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Max <max@zed.dev>
2024-04-23 16:23:26 -07:00
Conrad Irwin
e0c83a1d32
remote projects per user (#10594)
Release Notes:

- Made remote projects per-user instead of per-channel. If you'd like to
be part of the remote development alpha, please email hi@zed.dev.

---------

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Bennet <bennetbo@gmx.de>
Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2024-04-23 15:33:09 -06:00
Joseph T. Lyons
f6eaa8b00f
Clean up whitespace (#10755)
I saved the `file_types.json` file and got a diff because it had some
trailing whitespace. I ran
[`lineman`](https://github.com/JosephTLyons/lineman) on the codebase.
I've done this before, but this time, I've added in the following
settings to our `.zed` local settings, to make sure every future save
respects our desire to have consistent whitespace formatting.

```json
"remove_trailing_whitespace_on_save": true,
"ensure_final_newline_on_save": true
```

Release Notes:

- N/A
2024-04-23 13:31:21 -04:00
Marshall Bowers
63c529552c
Automatically install the HTML extension (#10867)
This PR makes it so the HTML extension will be installed in Zed by
default.

We feel we should keep HTML available out-of-the-box, but we want to do
so while still keeping it as an extension (as opposed to built-in to Zed
natively). There may be a world where we bundle the extension in with
the Zed binary itself, but installing it on startup gets us 99% of the
way there.

The approach for making HTML available by default is quite general, and
could be applied to any extension that we choose (likely other languages
that we want to come out-of-the-box, but that could then be moved to
extensions).

If you do not want the HTML extension in Zed, you can disable the
auto-installation in your `settings.json` and then uninstall the
extension:

```json
{
  "auto_install_extensions": {
    "html": false
  }
}
```

Release Notes:

- Added auto-installation for the HTML extension on startup.
- This can be disabled by adding `{ "auto_install_extensions": { "html":
false } }` to your settings.
2024-04-22 18:02:22 -04:00
Lachlan Campbell
74241d9f93
Add woff(2) to file type icon list (#10833)
I noticed the sidebar was using the fallback icons for woff/woff2
webfont files, instead of the font icon:

<img width="195" alt="CleanShot 2024-04-22 at 03 01 18@2x"
src="https://github.com/zed-industries/zed/assets/5074763/2e925c33-0be5-4ed9-ae87-ce72f95f8416">

With this PR, I'm hoping all those font files would use the A icon
instead.

Release Notes:

- Updated`.woff` & `.woff2` file types in the sidebar to display the
font icon.
2024-04-22 12:37:05 +03:00
Mikayla Maki
8a02159b82
Add a command to expand the context for a multibuffer (#10300)
This PR adds an action to expand the excerpts lines of context in a
multibuffer.

Release Notes:

- Added an `editor::ExpandExcerpts` action (bound to `shift-enter` by
default), which can expand the excerpt the cursor is currently in by 3
lines. You can customize the number of lines by rebinding this action
like so:

```json5
// In your keybindings array...
  {
    "context": "Editor && mode == full",
    "bindings": {
      "shift-enter": ["editor::ExpandExcerpts", { "lines": 5 }],
    }
  }
```

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-04-19 14:27:56 -07:00
Thorsten Ball
f082344747
Add pull requests to git blame tooltip (#10784)
Release Notes:

- Added links to GitHub pull requests to the git blame tooltips, if they
are available.

Screenshot:

(Yes, the icon will be resized! cc @iamnbutler)

![screenshot-2024-04-19-18 31
13@2x](https://github.com/zed-industries/zed/assets/1185253/774af0b3-f587-4acc-aa1e-1846c2bec127)
2024-04-19 18:54:20 +02:00
Thorsten Ball
9247da77a3
git blame: Display GitHub avatars in blame tooltips, if available (#10767)
Release Notes:

- Added GitHub avatars to tooltips that appear when hovering over a `git
blame` entry (either inline or in the blame gutter).

Demo:



https://github.com/zed-industries/zed/assets/1185253/295c5aee-3a4e-46aa-812d-495439d8840d
2024-04-19 15:15:19 +02:00
Philipp Schaffrath
2f892e3523
Improve drop targets (#10643)
This introduces multiple improvements to the drop targets.

## Hitbox shape
Currently, hitboxes are rectangles, where the vertical ones reach all
the way to the ends, which reduces the space for the horizontal ones,
making the hitboxes a bit awkward in the corners. This new approach just
determines the closest side.

Visual representation:
![Frame
3](https://github.com/zed-industries/zed/assets/1282767/1cd2ca31-d9d4-41dd-87fb-1a8fbb8b7fcc)

## Hitbox size
The width of the hitbox was currently always 8 rem all around. In setups
with many columns or rows, or when the font size was very large, this
could potentially overlap the center hitbox, not allowing to drop a tab
without another split. Now the width of the hitboxes are a fraction of
the smaller size of its parents width and height. This makes sure the
hitboxes have the same width all around, but never fully block the
center hitbox.

I've also made this value configurable through the new
`drop_target_size` config which takes a `f32` fraction and is set to 0.2
by default.

Not sure if this is worth mentioning, but this technically allows to
remove the split hitboxes all together by setting it to `0.0`, or
removing the center hitbox by setting it to any value `>=0.5`. Not that
this is necessary, but it would be possible now.

## Larger visualization
The visual overlay when using one of the side hitboxes were also `8em`
wide. Since their logical size now changed, and it can't currently be
represented with GPUI (without abusing the `canvas` element), I made the
visual feedback take half of the width or height of the available space,
just like how other editors do this.

Also, the opacity/alpha value set by a theme is currently ignored. This
change now respects the themes opacity for it!

## Respect alpha value
Currently, the alpha value of `drop_target.background` is ignored. Even
the default themes set a value that is overwritten by a hard coded
value. I have removed this hard coded value and it now respects the
alpha value.

This change affects existing themes, see
https://github.com/zed-industries/zed/pull/10643#issuecomment-2059641528


## ~~No more lag while dragging over gutter~~ Extracted into #10737
~~It looks like the editor had a small optimization to drop events when
hovering the gutter. This also happens while dragging a tab over the
gutter, and causes some stuttering. Please correct me if this wasn't
just a small optimization, but I could not derive a different reason for
this code to exist.~~

Here is a video that tries to show all those changes with a before on
the left, and the after on the right:


https://github.com/zed-industries/zed/assets/1282767/f97f3420-513f-410f-a1c8-7966429ad348


Release Notes:

- Added `drop_target_size` setting. This should be a fractional percent
(e.g., `0.5`).
- Improved the hitboxes for drop targets.
- Updated drop targets to respect the alpha channel of the
`drop_target.background` color.
2024-04-18 15:28:25 -04:00
David Baldwin
1b75f9d620
Add a setting to show/hide the project panel button in the status bar (#10707)
### What?

A setting has been added to control the visibility of the Project Panel
button in the status bar.

### Why?

I don't tend to use the Project Panel, but use a keyboard shortcut to
access if needed. Thus, the button in the status bar provides me little
more than visual clutter. Additionally, there is precedent for this
configurability with other panels (collaboration, chat, notification,
terminal, etc).

Release Notes:

- Added a setting to show/hide the Project Panel button in the status
bar. `{"project_panel": {"button": false}}`
2024-04-18 10:14:06 +03:00
Nate Butler
e93d554725
Add Editor Controls Menu to Tool Bar (#10655)
This PR adds an editor controls menu to the tool bar. This menu will be
used to contain controls that toggle visual features in the editor, like
toggling inlay hints, showing git status or blame, hiding the gutter,
hiding or showing elements in the tool bar, etc.

For the moment, this consolidates the new Inline Git Blame toggle and
the old Inlay Hints toggle. In the future it will contain additional
controls.

Before: 

![CleanShot - 2024-04-16 at 16 38
53@2x](https://github.com/zed-industries/zed/assets/1714999/249e353f-786a-4391-8d49-66dd61feff8a)

After:

![CleanShot - 2024-04-16 at 16 38
43@2x](https://github.com/zed-industries/zed/assets/1714999/5b3cf4d5-855a-4475-ac05-8474b6c94b7b)

---

Release Notes:

- Added an editor controls menu to the tool bar. This will contain
visual, editor-specific options like toggling inlay hints, showing git
status or blame, etc.
- Removed the top level inlay hint toggle from the tool bar due to the
above change.
- Added the ability to toggle inline git blame from the new editor
controls menu.

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-04-16 18:03:54 -04:00
Andrew Lygin
4eb1e65fbb
Add centered layout support (#9754)
This PR implements the Centered Layout feature (#4685):
- Added the `toggle centered layout` action.
- The centered layout mode only takes effect when there's a single
central pane.
- The state of the centered layout toggle is saved / restored between
Zed restarts.
- The paddings are controlled by the `centered_layout` setting:

```json
"centered_layout": {
  "left_padding": 0.2,
  "right_padding": 0.2
}
```

This allows us to support both the VSCode-style (equal paddings) and
IntelliJ-style (only left padding in Zen mode).

Release Notes:

- Added support for Centered Layout
([#4685](https://github.com/zed-industries/zed/pull/9754)).


https://github.com/zed-industries/zed/assets/2101250/2d5b2a16-c248-48b5-9e8c-6f1219619398

Related Issues:

- Part of #4382
2024-04-16 12:12:41 -07:00
Thorsten Ball
c015b5c4cd
Enable inline-git-blame by default (#10632)
Release Notes:

- N/A
2024-04-16 18:53:57 +02:00