Commit Graph

12319 Commits

Author SHA1 Message Date
KCaverly
0d6880adb3 removed stale dbg in assistant from main 2023-09-27 09:13:00 -04:00
Kyle Caverly
2f368de397
leverage file outline and selection as opposed to entire file (#3040)
Transition generate prompt for inline assist to leverage outline as
opposed to full file.
This enables, us to leverage the inline assist for large files.

Release Notes:

- Change inline assist to use tree-sitter based outlines for code
generation instead of full files
2023-09-27 09:10:18 -04:00
KCaverly
650a160f04 update test outline for prompt tests for new cursor span 2023-09-27 09:06:53 -04:00
Piotr Osiewicz
ecb037fc0e
language: Add block_comment to CSS (#3045)
Fixes zed-industries/community#2081

Release Notes:
- Fixed "toggle comment" action not working in CSS buffers.
2023-09-27 11:56:26 +02:00
Conrad Irwin
30bb3a109e
Add SwapPaneInDirection (#3043)
- Add cmd-k shift-{left,right,up,down} to swap panes in that direction
- vim: Add ctrl-w shift-{h,j,k,l} to swap panes in that direction
([#278](https://github.com/zed-industries/community/issues/278))
2023-09-26 22:18:02 -06:00
Conrad Irwin
37b6e1cbb7 Add SwapPaneInDirection
Add keybindings for vim (and non-vim)
2023-09-26 22:00:51 -06:00
Kirill Bulatov
cb83b49432
Hide inlay hints toggle if they are not supported by the current editor (#3041)
Release Notes:

- N/A
2023-09-27 01:16:02 +03:00
Marshall Bowers
568fec0f54
Add Sized bound to StyleHelpers (#3042)
This PR adds a `Sized` bound to the `StyleHelpers` trait.

All of the individual methods on this trait already had a `Self: Sized`
bound, so moving it up to the trait level will make it so we don't have
to repeat ourselves so much.

There's an open question of whether we can hoist the `Sized` bound to
`Styleable`, but it's possible there are cases where we'd want to have a
`Styleable` trait object.

Release Notes:

- N/A
2023-09-26 18:15:41 -04:00
Kirill Bulatov
7e2cef98a7 Hide inlay hints toggle if they are not supported by the current editor 2023-09-26 23:52:11 +02:00
KCaverly
90f17d4a28 updated codegen match to leverage unused values 2023-09-26 17:11:20 -04:00
KCaverly
e8dd412ac1 update inline generate prompt to leverage more explicit <|START| and |END|> spans 2023-09-26 17:10:31 -04:00
KCaverly
54c63063e4 changed inline assist generate prompt to leverage outline as opposed to entire prior file
Co-Authored-by: Antonio <antonio@zed.dev>
2023-09-26 16:23:48 -04:00
Joseph T. Lyons
e9e558d8c8
Rework call events api (#3038)
There were times when events with bad data were being emitted. What we
found was that places where certain collaboration-related code could
fail, like sending an invite, would still send events; those events
would be in a bad state, as certain elements, such as a room, weren't
constructed as expected, causing the event to have missing data. The new
API guarantees that we have data in the correct configuration. In the
future, we will add events for certain types of failures within Zed, to
cover things like invites failing.

Release Notes:

- N/A
2023-09-26 14:29:25 -04:00
Joseph T. Lyons
0897ed561f Rework call events api
There were time when events with bad data were being emitted. What we found was that places where certain collaboration-related code could fail, like sending an, would still send events, and those events be in a bad state, as certain elements weren't constructed as expected, thus missing in the event. The new API guarantees that we have data in the correct configuration. In the future, we will add events for certain types of failures within Zed.

Co-Authored-By: Julia <30666851+ForLoveOfCats@users.noreply.github.com>
2023-09-26 14:18:32 -04:00
Piotr Osiewicz
e263805847
workspace: change save prompt for unnamed buffers (#3037)
Release Notes:
- N/A
2023-09-26 19:35:10 +02:00
Piotr Osiewicz
8c47f117db
editor: Start transaction in replace impl (#3036)
This fixes the undo with replace in project
/cc @maxbrunsfeld 

Release Notes:

- N/A
2023-09-26 19:21:15 +02:00
Piotr Osiewicz
36f022bb58
project_replace: Fix up key bindings (#3034)
Release Notes:
- N/A
2023-09-26 18:40:41 +02:00
Marshall Bowers
342a00b89e
Remove dbg! from styleable_helpers! (#3035)
This PR removes a leftover `dbg!` from `styleable_helpers!`.

We already removed this in the `gpui2-ui` branch, but getting this on
`main` since @KCaverly pointed it out.

Release Notes:

- N/A
2023-09-26 10:49:55 -04:00
Kirill Bulatov
5e7f0c65fe
Fix another place where Copilot may panic (#3033) 2023-09-26 11:12:36 +03:00
Kirill Bulatov
b131a2cb98 Fix another place where Copilot may panic 2023-09-26 10:51:13 +03:00
Joseph T. Lyons
b5a39de3e2 Add reset_db script 2023-09-25 21:45:28 -04:00
Conrad Irwin
42df5ef45e
vim: Add multicursor shortcuts (#3032)
Adding a few bindings to bring first class feeling multiselect to zed's
vim emulation.

gn and gN are similar to similar vim bindings, ga is similar to gA (and
I doubt we need vim's real ga), g> and g< are just made up.

Release Notes:

- vim: `g n` / `g N` to select next/previous
- vim: `g >` / `g <` to skip current selection and select next/previous
- vim: `g a` to select all
2023-09-25 17:18:12 -05:00
Conrad Irwin
b29e295e1b vim: Add multicursor shortcuts
- g n / g N to select next/previous
- g > / g < to select next/previous replacing current
- g a to select all matches
2023-09-25 15:32:03 -06:00
Mikayla Maki
8c90157990
Fix space and copy/paste when editing a channel (#3030)
This fixes several bugs with how spaces and keyboard commands interact
with channel creating / renaming.

fixes
https://github.com/zed-industries/community/discussions/2076#discussioncomment-7096959

Release Notes:

- N/A
2023-09-25 15:20:00 -05:00
Conrad Irwin
b454f43b6c
Add cmd-+ as an alias for cmd-= (#3028)
Release Notes:

- Allow cmd-+ in addition to cmd-= for zoom in
([#1021](https://github.com/zed-industries/community/issues/1021)).

Although I had initially thought this was something more to do with
option key handling, it turns out to be a straightforward and reasonable
feature request.
2023-09-25 14:45:46 -05:00
Conrad Irwin
d17d38fe70
vim: Command (#2951)
Release Notes:

- vim: Add v1 of command mode
([#279](https://github.com/zed-industries/community/issues/279)). The
goal was to cover 90% of what most people actually do, but it is very
incomplete. Known omissions are that ranges cannot be specified (except
that `:%s//` must always specify the % range), commands cannot take
arguments (you can `:w` but not `:w [file]`), and there is no history.
Please file feature requests on
https://github.com/zed-industries/community as you notice things that
could be better.
- `:` triggers zed's command palette. If you type a known vim command it
will run it, otherwise you get zed's normal fuzzy search. For this
release supported commands are limited to:
- - `:w[rite][!]`, `:wq[!]`, `:q[uit][!]`, `:wa[ll][!]`, `:wqa[ll][!]`,
`:qa[ll][!]`, `:[e]x[it][!]`, `:up[date]` to save/close tab(s) and
pane(s).
- - `:cq` to quit completely.
- - `:vs[plit]`, `:sp[lit]` to split vertically/horizontally
- - `:new`, `:vne[w]` to create a new file in a new pane above or to the
left
- - `:tabedit`, `:tabnew` to create a new file in a new tab.
- - `:tabn[ext]`, `:tabp[rev]` to go to previous/next tabs
- - `:tabc[lose]` to close tabs
- - `:cn[ext]`, `:cp[rev]`, `:ln[ext]`, `:lp[rev]` to go to the
next/prev diagnostics.
- - `:cc`, `:ll` to open the errors page
- - `:<number>` to jump to a line number.
- - `:$` to jump to end of file
- - `:%s/foo/bar/` (note that /g is always implied, the range must
always be %, and zed uses different regex syntax to vim)
- - `:/foo` and `:?foo` to jump to next/prev line matching foo
- - `:j[oin]`, to join the current line (no range is yet supported)
- - `:d[elete][l][p]`, to delete the current line (no range is yet
supported)
- - `:s[ort] [i]` to sort the current selection (case-insensitively)
- vim: Add `ctrl-w o` (closes everything except the current item) and
`ctrl-w n` (creates a new file in the pane above).
([#1884](https://github.com/zed-industries/community/issues/1884))
- all: Add a "Discard" option to prompt when saving a file with
conflicts (previously this only appeared on close, not on save).

Internal changes:
- The Picker will now wait for pending queries before confirming (to
handle people typing `: w enter` rapidly.
- workspace::save_item and Pane::save_item are now merged together, and
the behavior controlled by `workspace::SaveIntent`.
- Many actions related to closing/saving items now take an optional
`SaveIntent`.
-
2023-09-25 14:07:22 -05:00
Mikayla
667fc25766
Fix space and copy/paste when editing a channel 2023-09-25 11:31:02 -07:00
Conrad Irwin
359847d047 Revert "Revert "workspace: Improve save prompt. (#3025)""
This reverts commit 5c75450a77.
2023-09-25 12:18:03 -06:00
Mikayla Maki
591ec02cea
Add support for the experimental Next LS for Elixir (#3024)
This is a PR I built for a friend of a friend at StrangeLoop, who is
making a much better LSP for elixir that elixir folks want to experiment
with. This PR also improves the our debug log viewer to handle LSP
restarts.

TODO:
- [ ] Make sure NextLS binary loading works.

Release Notes:

- Added support for the experimental Next LS for Elxir, to enable it add
the following field to your settings to enable:

```json
"elixir": {
    "next": "on"
}
```
2023-09-25 12:52:56 -05:00
Mikayla
c2fca054ae
Fix compile and test errors 2023-09-25 10:46:09 -07:00
Julia
bf6c2f0dfd
Activate correct item when clicking on a code action with the mouse (#3027)
Release Notes:

- Fixed clicking a code action only ever performing the first action in
the list rather than the one clicked on.
2023-09-25 13:45:20 -04:00
Conrad Irwin
769c330b3d Merge branch 'vim-command' 2023-09-25 11:41:13 -06:00
Conrad Irwin
5c75450a77 Revert "workspace: Improve save prompt. (#3025)"
This reverts commit 0a491e773b.
2023-09-25 11:41:09 -06:00
Mikayla
ad7c1f3c81
Download next-ls automatically from github 2023-09-25 10:40:20 -07:00
Conrad Irwin
23767f734f Add cmd-+ as an alias for cmd-=
For github.com/zed-industries/community#1021
2023-09-25 11:31:34 -06:00
Julia
80eaabd360 Activate correct item when clicking on a code action with the mouse 2023-09-25 13:31:00 -04:00
Julia
ff5d0f2aeb
Trigger scroll_to on code action list when moving selection (#3026)
Release Notes:
- Fixed the code action popup menu not scrolling as selection moves.
2023-09-25 11:21:24 -04:00
Julia
a278428bd5 Trigger scroll_to on code action list when moving selection 2023-09-25 11:13:50 -04:00
Piotr Osiewicz
0a491e773b
workspace: Improve save prompt. (#3025)
Add buffer path to the prompt.

Z-2903

Release Notes:
- Added a "Save all/Discard all" prompt when closing a pane with
multiple edited buffers.
2023-09-25 16:15:29 +02:00
Mikayla
8b63e45f0b
Implement LSP adapter methods for syntax highlighting 2023-09-24 05:08:05 -07:00
Mikayla
052cb459a6
Improve lsp log viewer's behavior in the presence of LSP restarts
Improve settings interface to local LSP
2023-09-24 04:59:55 -07:00
Marshall Bowers
0697d08e54
Restructure ui into just elements and components (#3023)
This PR restructures the `ui` crate into just `elements` and
`components`.

This was already done on the `gpui2-ui` branch, just getting it onto
`main`.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <nate@zed.dev>
2023-09-22 21:27:47 -04:00
Marshall Bowers
895386cfaf
Mainline Icon and IconButton changes (#3022)
This PR mainlines the `Icon` and `IconButton` changes from the
`gpui2-ui` branch.

Release Notes:

- N/A

Co-authored-by: Nate Butler <nate@zed.dev>
2023-09-22 19:14:12 -04:00
Marshall Bowers
ad62a966a6
Display available stories in storybook CLI (#3021)
This PR updates the storybook CLI to support displaying all of the
available stories.

The `--help` flag will now show a list of all the available stories:

<img width="1435" alt="Screenshot 2023-09-22 at 6 11 00 PM"
src="https://github.com/zed-industries/zed/assets/1486634/284e1a24-46ec-462e-9709-0f9b6e94931f">

Inputting an invalid story name will also show the list of available
stories:

<img width="1435" alt="Screenshot 2023-09-22 at 6 10 43 PM"
src="https://github.com/zed-industries/zed/assets/1486634/1ce3ae3f-ab03-4976-a06a-5a2b5f61eae3">

Release Notes:

- N/A
2023-09-22 18:16:16 -04:00
Marshall Bowers
fe4248cf34
Scaffold Toolbar and Breadcrumb components (#3020)
This PR scaffolds the `Toolbar` and `Breadcrumb` components.

Right now they both just consist of hardcoded data.

<img width="846" alt="Screenshot 2023-09-22 at 4 54 00 PM"
src="https://github.com/zed-industries/zed/assets/1486634/70578df2-7216-42d2-97ef-d38b83fb4a25">

<img width="799" alt="Screenshot 2023-09-22 at 4 46 04 PM"
src="https://github.com/zed-industries/zed/assets/1486634/73ca3d8a-baf9-4ed4-b4c4-279c674672a3">

Release Notes:

- N/A
2023-09-22 16:57:33 -04:00
Marshall Bowers
27e3e09bb9
Label component states in stories (#3019)
This PR updates the UI component stories to label the various states
that they are in.

Release Notes:

- N/A
2023-09-22 15:48:32 -04:00
Marshall Bowers
d0b15ed940
Report which requested font families are not present on the system (#3006)
This PR improves the error message when `FontCache.load_family` attempts
to load a font that is not present on the system.

I ran into this while trying to run the `storybook` for the first time.
The error message indicated that a font family was not found, but did
not provide any information as to which font family was being loaded.

### Before

```
   Compiling storybook v0.1.0 (/Users/maxdeviant/projects/zed/crates/storybook)
    Finished dev [unoptimized + debuginfo] target(s) in 8.52s
     Running `/Users/maxdeviant/projects/zed/target/debug/storybook`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: could not find a non-empty font family matching one of the given names', crates/theme/src/theme_settings.rs:132:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating due to uncaught foreign exception
fish: Job 1, 'cargo run' terminated by signal SIGABRT (Abort)
```

### After

```
   Compiling storybook v0.1.0 (/Users/maxdeviant/projects/zed/crates/storybook)
    Finished dev [unoptimized + debuginfo] target(s) in 7.90s
     Running `/Users/maxdeviant/projects/zed/target/debug/storybook`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: could not find a non-empty font family matching one of the given names: `Zed Mono`', crates/theme/src/theme_settings.rs:132:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating due to uncaught foreign exception
fish: Job 1, 'cargo run' terminated by signal SIGABRT (Abort)
```

Release Notes:

- N/A
2023-09-22 15:27:42 -04:00
Marshall Bowers
8b6e982495
Remove manual mapping in FromStr implementation for StorySelector (#3018)
This PR removes the need for writing manual mappings in the `FromStr`
implementation for the `StorySelector` enum used in the storybook CLI.

We are now using the
[`EnumString`](https://docs.rs/strum/0.25.0/strum/derive.EnumString.html)
trait from `strum` to automatically derive snake_cased names for the
enums.

This will cut down on some of the manual work needed to wire up more
stories to the storybook.

Release Notes:

- N/A
2023-09-22 14:06:09 -04:00
Marshall Bowers
71c1e36d1e
Put Theme behind an Arc (#3017)
This PR puts the `Theme` returned from the `theme` function behind an
`Arc`.

### Motivation

While working on wiring up window focus events for the `TitleBar`
component we ran into issues where `theme` was holding an immutable
borrow to the `ViewContext` for the entirety of the `render` scope,
which prevented having mutable borrows in the same scope.

### Explanation

To avoid this, we can make `theme` return an `Arc<Theme>` to allow for
cheap clones and avoiding the issues with the borrow checker.

Release Notes:

- N/A

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2023-09-22 13:35:30 -04:00
Marshall Bowers
d8c6adf338
Factor story boilerplate out into separate components (#3016)
This PR factors out the bulk of the boilerplate required to setup a
story in the storybook out into separate components.

The pattern we're using here is adapted from the "[associated
component](https://maxdeviant.com/posts/2021/react-associated-components/)"
pattern in React.

Release Notes:

- N/A
2023-09-22 11:38:01 -04:00