Commit Graph
100 Commits
Author SHA1 Message Date
Nathan SoboandAntonio Scandurra 8f8a99d788 Bind cmd-? to assistant::toggle_focus
Bypass system help menu shortcut at the app delegate level to achieve this.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 11:43:24 +02:00
Nathan SoboandAntonio Scandurra 7efcd60608 Remove border from assistant message header
Also: Increase right margin on token count to space it from the scrollbar.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:54:44 +02:00
Nathan SoboandAntonio Scandurra 83fc7b9b7c Avoid scrolling to the new cursor position so the assistant's output is stable
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:32:06 +02:00
Nathan SoboandAntonio Scandurra f52d3ea5ef Clean up tooltips, create conversation on cmd-n
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:27:29 +02:00
Nathan SoboandAntonio Scandurra d41a7f41fb Space out assistant icons to match pane icons
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-28 10:00:28 +02:00
Nathan Sobo 04d93dfbd9 vim: indent/outdent (#2644)
Release Notes:

- vim: support indent/outdent
([#832](https://github.com/zed-industries/community/issues/832>)).
2023-06-27 04:15:55 -06:00
Nathan Sobo fd3ee0ebd0 Vim toggle case (#2648)
Release Notes:

- vim: Add ~ to toggle case
([#1410](https://github.com/zed-industries/community/issues/1410))
2023-06-27 04:13:24 -06:00
Nathan Sobo 29b2639b4c Merge remote-tracking branch 'origin/main' into vim-indent 2023-06-27 12:09:47 +02:00
Nathan Sobo 16c23557b8 vim: Fix scrolling (#2647)
After #2641 we noticed that scrolling didn't take a count parameter, and
a few other issues with the way that we calculated the distance to
scroll.
 
Release Notes:

- Improved distance calculations for page-up/page-down
- vim: Allow counts to work with scrolling shortcuts.
2023-06-27 04:01:14 -06:00
Nathan Sobo 7294314ce7 vim: shortcuts for tab navigation (#2649)
Release Notes:

- vim: added gt/ctrl-pagedown and gT/ctrl-pageup for tab navigation
2023-06-27 03:57:01 -06:00
Nathan Sobo 0fd0b60bd6 vim: Fix code actions menu (#2650)
Fixes: zed-industries/community#1690

I'm not sure this is the correct way to fix this...
* A simpler approach would be to just say `!showing_code_actions` in the
binding file (as `showing_completions` can only happen in insert mode -
and `VimControl` will be false). This seemed a little error prone if
more menus were added in the future.
* A more complicated approach would be to copy the way this is done from
the MouseContextMenu, which registers its own keyboard shortcuts, and as
such uses those when it's open. This seems "more correct", but is a
major refactoring for a very small reward.

Release Notes:

- vim: Fix code actions menu
([#1690](https://github.com/zed-industries/community/issues/1690))
2023-06-27 03:56:08 -06:00
Nathan Sobo 3f4a06f576 Add an Element derive macro for building components out of other elements (#2643)
To turn any struct into a composite element, you can implement a render
method with the following signature:

```rs
fn render<V: View>(&mut self, view: &mut V, cx: &mut ViewContext<V>) -> AnyElement<V>;
```

Then add #[derive(Element)] to the struct definition.

This will make it easier to introduce higher-level components that are
expressed in terms of other elements. Instead of calling functions that
return elements, we can now make any struct into an element fairly
easily. The advantage is that we can use method chaining to express
optional state on these components, and they blend in better with other
elements.

cc @mikayla-maki @osiewicz @iamnbutler 

Release Notes:

- N/A
2023-06-25 08:12:02 -06:00
Nathan Sobo bede668b14 Add a derive macro for Element
To turn any struct into a composite element, you can implement a render method
with the following signature:

fn render<V: View>(&mut self, view: &mut V, cx: &mut ViewContext<V>) -> AnyElement<V>;

Then add #[derive(Element)] to the struct definition.

This will make it easier to introduce higher-level components that are expressed in
terms of other elements.
2023-06-25 07:51:50 -06:00
Nathan Sobo 1707652643 Always focus a panel when zooming it
This allows us to zoom a panel when clicking a button, even if the
panel isn't currently focused.
2023-06-22 06:55:31 -06:00
Nathan Sobo ea5398a702 vim: binding fixes (#2637)
Release Notes:

- In vim mode you can now use count modifiers with arrow keys (`5<down>`
will go down 5 lines).
- In vim mode `ctrl+]` and `ctrl+o` now work to go to definition and
back
2023-06-22 06:44:12 -06:00
Nathan Sobo cd008d1503 Add support for joining lines (#2636)
🚧 We have a couple more refinements to this to add 🚧 

Release Notes:

You can now join lines with `ctrl-j` or `shift-J` in Vim normal mode.

🍐'd with @ConradIrwin
2023-06-22 06:38:57 -06:00
Nathan Sobo a49189a704 Add Zoom button to assistant panel 2023-06-21 19:50:22 -06:00
Nathan Sobo a75341db97 Move model and remaining tokens to assistant toolbar 2023-06-21 19:01:30 -06:00
Nathan SoboandConrad Irwin a365b2f177 Add shift-J binding to Vim normal mode
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:58:31 -06:00
Nathan SoboandConrad Irwin cde8d7d747 Don't use test-only method; add ctrl-j binding
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:53:11 -06:00
Nathan SoboandConrad Irwin cf38264eda Handle multiple selections when joining lines
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:47:06 -06:00
Nathan SoboandConrad Irwin 61352f68ea Add more assertions for joining lines at the end of the file
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:21:09 -06:00
Nathan SoboandConrad Irwin f07a929350 Allow joining multiple lines and deleting empty lines
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 11:18:28 -06:00
Nathan SoboandConrad Irwin c48bd394c1 Start on joining lines
Co-Authored-By: Conrad Irwin <conrad.irwin@gmail.com>
2023-06-21 10:32:02 -06:00
Nathan Sobo d78fbbc63e Add title to assistant panel and move + to right 2023-06-21 09:54:49 -06:00
Nathan Sobo 0932149c48 Fix filename 2023-06-20 20:21:43 -06:00
Nathan Sobo 3a61fd503f WIP: Trying to display the toolbar but tired. May be worth discarding this. 2023-06-20 20:11:37 -06:00
Nathan SoboandJulia Risley 23bc11f8b3 Remove the nested Pane from the assistant
Since we don't want tabs, I think it would be better to render the toolbar
for ourselves directly and handle switching between conversations.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 18:52:48 -06:00
7a051a0dcb Panic in debug if global settings can't be deserialized from defaults
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 18:12:59 -06:00
Nathan SoboandJulia Risley bd7f8e8b38 Scan conversations dir on assistant panel open and on changes
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-06-20 16:19:43 -06:00
Nathan SoboandKyle Caverly 230b4d237e Add SavedConversation::list() method
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-06-20 13:29:34 -06:00
Nathan SoboandKyle Caverly 9f783944a7 Wait until we have a summary before saving a conversation
Also, avoid collisions by adding a discriminant.

Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-06-20 13:03:23 -06:00
Nathan Sobo 03993ea719 Rename SumTree::push_tree to ::append (#2626)
This is something I've been meaning to rename in SumTree. Was looking at
the code and figure why not now.
2023-06-20 08:37:55 -06:00
Nathan Sobo 8c298a9da5 Rename SumTree::push_tree to ::append 2023-06-19 19:49:33 -06:00
Nathan Sobo 882009bc75 Save conversations to ~/.config/zed/conversations
Still need to implement loading / listing.
I'd really be rather write operations to a database. Maybe we
should be auto-saving? Integrating with panes? I just did
the simple thing for now.
2023-06-16 16:15:07 -06:00
Nathan Sobo c3b2b4c4e3 Cycle message roles on ctrl-r (#2619)
I'd like to follow up to allow roles to be cycled for the selected range
and support multi-cursors, but this is a start and contains a
refactoring, so going to merge.

Release Notes:

- Added the ability to cycle roles in the assistant with `ctrl-r`
2023-06-16 14:11:01 -06:00
Nathan Sobo 54c71c1a35 Insert reply after the currently selected user message 2023-06-16 12:41:07 -06:00
Nathan Sobo 11f318566e Allow splitting of messages using shift-enter (#2613)
Closes
https://linear.app/zed-industries/issue/Z-2364/allow-splitting-blocks

Release Notes:

- Added support for splitting messages in the assistant panel using
`shift-enter`. (preview-only)
2023-06-16 11:50:50 -06:00
Nathan Sobo 75b5ac8488 Cycle message roles on ctrl-r 2023-06-16 11:50:18 -06:00
Nathan Sobo c179dd9990 Remove redundant tests 2023-06-16 11:43:16 -06:00
6c0f65cfe0 Avoid inserting redundant newlines
Co-Authored-By: Piotr Osiewicz <piotr@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-06-16 10:36:42 -06:00
8c6ba13fef Never insert an empty prefix when splitting a message with a non-empty range
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Piotr Osiewicz <piotr@zed.dev>
2023-06-15 09:02:15 -06:00
Nathan Sobo 23836eb251 Not working yet: Remove empty messages unless they contain the cursor
Problem is, I'm trying to trust the excerpt id of the selection head,
but it's a sentinel value and not the actual excerpt id of the message.
I think we probably need to resolve to offsets instead.
2023-06-05 22:58:08 -06:00
Nathan Sobo 8a851ad7f8 Fix annoying system prompt (#2538)
I was having fun, but it was too much. It makes the assistant too
annoying to be useful.

Release Notes:

Use `N/A` in this section if this item should be skipped in the release
notes.

Add release note lines here:

* Dialed back the system prompt on the assistant.
2023-05-29 22:05:40 -06:00
Nathan Sobo 063613bf4e Fix annoying system prompt
I was having fun, but it was too much. It makes the assistant too annoying to be useful.
2023-05-29 21:47:59 -06:00
Nathan Sobo ffbfbe422b WIP: Not sure I actually want to rip this out 2023-05-26 16:11:58 -06:00
Nathan Sobo 3904971bd8 Hide assistant gutter 2023-05-26 15:38:03 -06:00
Nathan Sobo 8f6e67f440 Cancel assists on escape 2023-05-26 14:49:27 -06:00
Nathan SoboandAntonio Scandurra 80080a43e4 Start on an assistant panel based on multi-buffers
Each message is represented as a multibuffer excerpt to allow for
fluid editing of the conversation transcript.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2023-05-26 10:09:55 -06:00
Nathan Sobo 0b7d095c0a Introduce the ability to talk to GPT-4 within buffers on preview and dev (#2524)
This adds basic ability to interact with OpenAI inside a buffer.

Release Notes:

* If`OPENAI_API_KEY` is defined in your environment, you can now run the
`ai: assist` command to pass the text of your current buffer to GPT-4.
If you're editing a file with a `.zmd` extension, you can also invoke
the model with `cmd-enter.` (preview-only)
2023-05-24 12:00:43 -06:00
Nathan Sobo 26051de160 Clean up 2023-05-24 11:08:00 -06:00
Nathan Sobo 747322a02d Merge remote-tracking branch 'origin/main' into zmd 2023-05-24 11:04:07 -06:00
Nathan Sobo d495c1b804 Only run AI agent on dev and preview 2023-05-24 10:58:33 -06:00
Nathan Sobo ba79a8ba94 WIP 2023-05-24 10:26:14 -06:00
Nathan Sobo 50e1e17d09 WIP 2023-05-24 09:53:08 -06:00
Nathan Sobo 051c7566cc WIP 2023-05-24 09:38:37 -06:00
Nathan Sobo 8abaf66602 WIP 2023-05-24 09:21:50 -06:00
Nathan Sobo 6368ade1da WIP 2023-05-24 09:12:16 -06:00
Nathan Sobo 637ed79603 WIP 2023-05-23 18:16:49 -06:00
Nathan Sobo 65fc50745b WIP 2023-05-23 18:04:33 -06:00
Nathan Sobo d934da1905 WIP 2023-05-23 15:25:34 -06:00
Nathan Sobo 7be41e19f7 WIP 2023-05-23 08:52:21 -06:00
Nathan Sobo 073967c80b WIP 2023-05-23 01:56:28 -06:00
Nathan Sobo 5362e7d346 WIP 2023-05-23 01:52:37 -06:00
Nathan Sobo 394e87d17c WIP 2023-05-23 01:23:01 -06:00
Nathan Sobo 0de5a444d3 WIP 2023-05-23 00:22:21 -06:00
Nathan Sobo 234dbc3ca9 WIP 2023-05-23 00:16:44 -06:00
Nathan Sobo c4d88bc529 WIP 2023-05-22 23:43:02 -06:00
Nathan Sobo 30de64845f WIP 2023-05-22 23:11:27 -06:00
Nathan Sobo 7e6cccfa3d WIP: Stream in completions
Drop dependency on tokio introduced by async-openai and do it ourselves.

The approach I'm taking of replacing instead of appending is causing issues. Need to just append.
2023-05-22 20:28:22 -06:00
Nathan Sobo d5cf595761 Enable "test-support" feature on editor dependencies for tests (#2499)
Enable the `"test-support"` feature whenever we depend on the `editor`
crate in tests.

If we don't do this, we end up depending on `livekit_client` without
enabling `"test-support"`, and this causes us to link against
`WebRTC.framework` in its build script, which causes a dynamic linker
error when starting the tests.

Fixes
https://linear.app/zed-industries/issue/Z-1646/cant-run-package-tests-for-activity-monitor-and-auto-update

Release Notes:

* No notes
2023-05-20 10:19:59 -06:00
Nathan Sobo 986eafd84e Enable test-support on editor in tests 2023-05-20 09:54:38 -06:00
Nathan Sobo 912fd23006 Parse markdown into an OpenAI chat completion request 2023-05-20 09:43:12 -06:00
Nathan Sobo ba50b35de6 wip 2023-05-13 14:34:09 -06:00
Nathan Sobo 6c60853842 Don't close panel on event unless active; add tests 2023-05-12 15:44:09 -06:00
Nathan Sobo bd795d7607 Preserve panel size when re-docking between left and right 2023-05-12 15:15:11 -06:00
Nathan Sobo 214354b4da Make panels independently resizable 2023-05-12 09:44:14 -06:00
Nathan Sobo ee3637216e Add TreeMap::remove_between that can take abstract start and end points
This commit introduces a new adaptor trait for SeekTarget that works around
frustrating issues with lifetimes. It wraps the arguments in a newtype wrapper
that lives on the stack to avoid the lifetime getting extended to the caller
of the method.

This allows us to introduce a PathSuccessor object that can be passed as the
end argument of remove_between to remove a whole subtree.
2023-05-12 08:21:01 -07:00
Nathan SoboandJulia Risley 5549669316 Test moving panels
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-05-10 10:41:03 -06:00
Nathan Sobo cc21421ea8 Rename item to panel in various locations 2023-05-10 09:54:20 -06:00
Nathan Sobo 9173916ab8 Remove unused terminal_button module 2023-05-09 20:24:37 -06:00
Nathan Sobo f554877ff4 Render the bottom dock buttons before the right dock buttons 2023-05-09 17:41:24 -06:00
Nathan SoboandJoseph Lyons ba248244ec Allow terminal to be docked left, bottom, or right
Co-Authored-By: Joseph Lyons <joseph@zed.dev>
2023-05-09 17:36:49 -06:00
Nathan SoboandJoseph Lyons 6a7feb4c4c Allow the project panel to be docked right or left
Co-Authored-By: Joseph Lyons <joseph@zed.dev>
2023-05-09 17:26:54 -06:00
Nathan Sobo 0d78266ddb Replace todo with unimplemented to reduce distractions 2023-05-09 16:41:10 -06:00
Nathan Sobo 6d16d2224d Merge branch 'main' into panels 2023-05-09 16:35:04 -06:00
Nathan Sobo 5e8b7bd06d Replace todo with unimplemented to reduce distractions 2023-05-09 16:31:53 -06:00
Nathan Sobo 6645323f1b WIP 2023-05-09 13:28:34 -06:00
Nathan Sobo 1ddbda5095 Rename DockItem to Panel 2023-05-09 10:18:11 +02:00
Nathan Sobo 03f8c1206a Rename Sidebar to Dock 2023-05-09 10:18:10 +02:00
Nathan Sobo 1919a826f9 Remove dock from workspace 2023-05-09 10:18:10 +02:00
Nathan Sobo a45282eb63 Merge pull request #2414 from zed-industries/spawn-weak-for-views
Pass a `WeakViewHandle` to `ViewContext::spawn`
2023-04-26 06:10:44 -06:00
Nathan Sobo e6604d1641 Fix missing actions in the command palette
Previously, the workspace view was on the stack when we were computing the
available actions, which excluded it. This is a stopgap. We should find a
better solution ASAP.
2023-04-21 15:59:29 -06:00
Nathan Sobo 83bf3d071d WIP 2023-04-21 15:36:52 -06:00
Nathan Sobo 55db28e074 Eliminate ReadModel trait 2023-04-21 15:05:19 -06:00
Nathan Sobo 5dac95c47c Eliminate ReadView trait 2023-04-21 15:03:57 -06:00
Nathan Sobo bce51c521a Merge pull request #2403 from zed-industries/into-element
Rename Element to AnyElement, Drawable to Element, and make containers generic over any Element type
2023-04-21 14:44:22 -06:00
Nathan Sobo 993dbf86cb Merge remote-tracking branch 'origin/main' into into-element 2023-04-21 14:27:25 -06:00
Nathan Sobo 09111b65d8 Merge pull request #2401 from zed-industries/simplify-context-lifetimes
Remove unnecessary lifetime parameter from WindowContext
2023-04-21 14:26:26 -06:00
Nathan Sobo caf3d5c163 Fix more formatting 2023-04-21 14:25:49 -06:00