Commit Graph
52 Commits
Author SHA1 Message Date
57ebc7334d Eliminate GPUI View, ViewContext, and WindowContext types (#22632)
There's still a bit more work to do on this, but this PR is compiling
(with warnings) after eliminating the key types. When the tasks below
are complete, this will be the new narrative for GPUI:

- `Entity<T>` - This replaces `View<T>`/`Model<T>`. It represents a unit
of state, and if `T` implements `Render`, then `Entity<T>` implements
`Element`.
- `&mut App` This replaces `AppContext` and represents the app.
- `&mut Context<T>` This replaces `ModelContext` and derefs to `App`. It
is provided by the framework when updating an entity.
- `&mut Window` Broken out of `&mut WindowContext` which no longer
exists. Every method that once took `&mut WindowContext` now takes `&mut
Window, &mut App` and every method that took `&mut ViewContext<T>` now
takes `&mut Window, &mut Context<T>`

Not pictured here are the two other failed attempts. It's been quite a
month!

Tasks:

- [x] Remove `View`, `ViewContext`, `WindowContext` and thread through
`Window`
- [x] [@cole-miller @mikayla-maki] Redraw window when entities change
- [x] [@cole-miller @mikayla-maki] Get examples and Zed running
- [x] [@cole-miller @mikayla-maki] Fix Zed rendering
- [x] [@mikayla-maki] Fix todo! macros and comments
- [x] Fix a bug where the editor would not be redrawn because of view
caching
- [x] remove publicness window.notify() and replace with
`AppContext::notify`
- [x] remove `observe_new_window_models`, replace with
`observe_new_models` with an optional window
- [x] Fix a bug where the project panel would not be redrawn because of
the wrong refresh() call being used
- [x] Fix the tests
- [x] Fix warnings by eliminating `Window` params or using `_`
- [x] Fix conflicts
- [x] Simplify generic code where possible
- [x] Rename types
- [ ] Update docs

### issues post merge

- [x] Issues switching between normal and insert mode
- [x] Assistant re-rendering failure
- [x] Vim test failures
- [x] Mac build issue



Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Joseph <joseph@zed.dev>
Co-authored-by: max <max@zed.dev>
Co-authored-by: Michael Sloan <michael@zed.dev>
Co-authored-by: Mikayla Maki <mikaylamaki@Mikaylas-MacBook-Pro.local>
Co-authored-by: Mikayla <mikayla.c.maki@gmail.com>
Co-authored-by: joão <joao@zed.dev>
2025-01-26 03:02:45 +00:00
Piotr Osiewicz 9b464f483b chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
2024-09-06 11:58:39 +02:00
ZZzzaaKK ab943e4c78 Reuse workspace on new journal entry command if possible (#16924)
Closes #6783

With this PR, the `journal: new journal entry` command only opens a new
workspace if the current workspace does not already contain the
`journal` directory. Both the root of the work tree and all its
subdirectories are checked.

This does not yet check for the day's file specifically, as suggested
[here](https://github.com/zed-industries/zed/issues/6783#issuecomment-2268509463).

I'm new to writing Rust code in production (as well as contributing in
general), so any feedback is much appreciated!

Release Notes:

- Reuse workspace on `journal: new journal entry` command if possible
2024-08-28 21:18:42 -07:00
a43e23b1d0 Add the ability for extensions to provide language settings (#10296)
This PR adds the ability for extensions to provide certain language
settings via the language `config.toml`.

These settings are then merged in with the rest of the settings when the
language is loaded from the extension.

The language settings that are available are:

- `tab_size`
- `hard_tabs`
- `soft_wrap`

Additionally, for bundled languages we moved these settings out of the
`settings/default.json` and into their respective `config.toml`s .

For languages currently provided by extensions, we are leaving the
values in the `settings/default.json` temporarily until all released
versions of Zed are able to load these settings from the extension.

---

Along the way we ended up refactoring the `Settings::load` method
slightly, introducing a new `SettingsSources` struct to better convey
where the settings are being loaded from.

This makes it easier to load settings from specific locations/sets of
locations in an explicit way.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2024-04-08 19:17:12 -04:00
Piotr Osiewicz 04bcc1f7aa Revert "Revert "chore: Bump Rust version to 1.77 (#9631)"" (#9672)
Reverts zed-industries/zed#9658, as the Docker image is now available.

Release notes:

- N/A
2024-03-22 11:17:16 +01:00
Marshall Bowers 59fe2767db Revert "chore: Bump Rust version to 1.77 (#9631)" (#9658)
This reverts commit cdd1be672d.

We can't upgrade to Rust 1.77 until there are Rust 1.77 Docker images
available
(https://github.com/docker-library/official-images/pull/16457).


Release Notes:

- N/A
2024-03-21 14:07:22 -04:00
Piotr Osiewicz cdd1be672d chore: Bump Rust version to 1.77 (#9631)
Release Notes:

- N/A
2024-03-21 15:42:59 +01:00
Conrad Irwin 2b8c42508f Add --add/--new to control CLI behaviour (#9202)
When neither is specified, if you open a directory you get a new
workspace, otherwise files are added to your existing workspace.

With --new files are always opened in a new workspace
With --add directories are always added to an existing workspace

Fixes #9076
Fixes #4861
Fixes #5370

Release Notes:

- Added `-n/--new` and `-a/--add` to the zed CLI. When neither is
specified, if you open a directory you get a new workspace, otherwise
files are added to your existing workspace. With `--new` files are
always opened in a new workspace, with `--add` directories are always
added to an existing workspace.
([#9076](https://github.com/zed-industries/zed/issues/9096),
[#4861](https://github.com/zed-industries/zed/issues/4861),
[#5370](https://github.com/zed-industries/zed/issues/5370)).
2024-03-12 14:27:58 -06:00
Conrad IrwinandNathan 5792239381 Fix panic in open urls (#9032)
Co-Authored-By: Nathan <nathan@zed.dev>

Release Notes:

- N/A

Co-authored-by: Nathan <nathan@zed.dev>
2024-03-07 13:52:50 -07:00
Mikayla ac8bcd985f Make platform input handler private
Automatically record the context on non-view input handlers
Simplify the async window context update() method
2024-01-20 06:56:19 -08:00
Piotr OsiewiczandKirill f4f65e9c2c Editor docs (#4097)
Release Notes:

- N/A

---------

Co-authored-by: Kirill <kirill@zed.dev>
2024-01-18 00:48:37 +01:00
Piotr OsiewiczandMarshall Bowers f90b05b716 Display setting documentation in settings.json (#3936)
Let this screenshot of settings.json speak for itself: 

![image](https://github.com/zed-industries/zed/assets/24362066/fca60383-1788-43f9-803b-00f083394c8a)

Release Notes:
- Added code completion & on-hover documentation to Zed's settings.json
file.

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-01-08 19:30:18 +01:00
Kirill Bulatov b9e1f95aa3 On external file drop, add visible project entries for directories only 2024-01-07 03:11:28 +02:00
Kirill Bulatov 10967ea45f Implement external file drop in pane 2024-01-07 01:18:02 +02:00
Marshall Bowers 0664cfe89b Restore timestamp insertion for journal: new journal entry (#3870)
This PR restores the insertion of the timestamp when using the `journal:
new journal entry` action.

Release Notes:

- Restored timestamp insertion when creating new journal entries.
2024-01-03 18:09:55 -05:00
Max BrunsfeldandMikayla 2e155121f8 Remove 2 suffix for collab, rope, settings, menu
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:29:16 -08:00
Max BrunsfeldandMikayla 74e6eb908f Remove 2 suffix for assistant, journal
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:14:01 -08:00
Max Brunsfeld e7f85efbb8 Rename settings::register_setting -> settings::register 2023-05-17 15:06:11 -07:00
Max Brunsfeld 30e678a450 Remove optional path argument when getting settings 2023-05-17 15:05:20 -07:00
Max Brunsfeld 56f2ff64ed Define language settings in the language crate 2023-05-16 17:29:53 -07:00
Max Brunsfeld 8abefb23c5 Define journal settings in journal crate 2023-05-10 12:59:24 -07:00
Antonio ScandurraandNathan Sobo fa65ca0628 Don't allow strong view handles to be read/updated with an AsyncAppContext
This avoids an invitation to hold strong view handles across async await
points, which is a common source of leaks.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-04-26 13:36:13 +02:00
Antonio Scandurra 8421d816a8 Merge branch 'main' into window_context_2 2023-04-20 16:01:47 +02:00
Antonio Scandurra 9254219f16 Fix warnings/errors now that AsyncAppContext::update returns Result 2023-04-18 14:58:57 +02:00
Antonio Scandurra 487c468521 Fix most of the warnings 2023-04-14 10:51:53 +02:00
Nathan Sobo d937660683 Merge MutableAppContext into AppContext
There may have been a good reason for the difference at some point, or I was
still learning Rust. But now it's just &mut AppContext vs &AppContext.
2023-04-06 15:49:03 -06:00
Mikayla Maki ccf4c95ae3 Merge pull request #2199 from zed-industries/welcome-experience
Welcome experience
2023-03-10 10:48:30 -08:00
Antonio Scandurra fb8351563a Introduce a new TryFutureExt::unwrap method 2023-03-10 11:41:13 +01:00
Mikayla MakiandMax 0930988bcc Change open paths to replace the existing window if dispatched from a window
co-authored-by: Max <max@zed.dev>
2023-03-07 17:28:52 -08:00
Kay Simmons acac7d292d Refactor editor scrolling and implement scroll commands from vim mode 2022-12-07 16:39:32 -08:00
Mikayla Maki ac539a2a36 And library change 2022-12-03 16:13:02 -08:00
Mikayla Maki df62cba2ef Tried alternate stratergy 2022-11-08 11:54:26 -08:00
Joseph T Lyons a750ebe868 Change journal location setting name to "path" and default to ~ 2022-09-29 17:12:57 -04:00
Joseph T Lyons 7267dc16c2 Remove "get" prefix from function names 2022-09-28 17:07:11 -04:00
Joseph T Lyons 52b1f60b87 Initial work to add settings to journal feature 2022-09-28 16:25:37 -04:00
Antonio Scandurra ebcbcc3956 Prevent setting files from showing up in project and contacts panels 2022-06-14 14:47:16 +02:00
Keith Simmons b03abdb6df Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice 2022-05-13 16:58:30 -07:00
Keith Simmons 851e04d46b Passing tests and removed local argument. Also pulled autoscroll argument out to change_selections 2022-05-13 15:55:27 -07:00
Keith Simmons 9b46bb0ee6 Move selection helpers to SelectionCollection, add update_anchor_selections, add a number of invariant preserving mutation functions to the MutableSelectionCollection 2022-05-13 15:55:17 -07:00
Antonio Scandurra 129f1ec634 Move project browser toggling logic in workspace::open_paths 2022-04-22 11:25:23 +02:00
Antonio Scandurra e724671336 Add only one worktree when running zed /dir /dir/file 2022-04-22 11:06:17 +02:00
Antonio Scandurra 4cdd9a9d35 Show project panel when opening a folder via the CLI 2022-04-22 10:45:46 +02:00
Antonio Scandurra 6350760340 Implement zed --wait 2022-04-20 17:28:31 +02:00
Max Brunsfeld 8bc0050578 Load all keybindings from JSON file 2022-04-10 14:29:45 -07:00
0cf9925cb1 Restructure action macro to assign a namespace to every action
Also, allow arbitrary types to be used as Actions via the impl_actions macro

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-07 16:20:49 -07:00
Antonio ScandurraandNathan Sobo ade37e946c Make "go to definition" work in project diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-20 17:30:30 +01:00
Max BrunsfeldandNathan Sobo a8488fee91 Merge branch 'main' into share-project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:42:59 -08:00
Nathan Sobo d831c18326 Fix journal format strings 2021-12-18 12:15:07 -07:00
Nathan Sobo 051c574744 Pad single-digit months, days, and minutes with a leading zero 2021-12-18 11:11:04 -07:00
Nathan Sobo 0fdc955732 Insert a time heading when creating a journal entry 2021-12-18 10:38:54 -07:00