ZIm/crates/project/src
Kyle Kelley 72d36d0213
Foundations for Open All the Things (#9353)
This is the beginning of setting up a flexible way to open items beyond
the text buffer -- think notebooks, images, GeoJSON, etc. The primary
requirement to allow opening an arbitrary file is `try_open` on the
`project::Item` trait. Now we can make new `Item`s for other types with
their own ways to render.

Under the hood, `register_project_item` uses this new opening scheme. It
supports a dynamic array of opener functions, that will handle specific
item types. By default, a `Buffer` should be able to be able to open any
file that another opener did not.

A key detail here is that the order of registration matters. The last
item has primacy. Here's an example:

```rust
workspace::register_project_item::<Editor>(cx);
workspace::register_project_item::<Notebook>(cx);
workspace::register_project_item::<ImageViewer>(cx);
```

When a project item (file) is attempted to be opened, it's first tried
with the `ImageViewer`, followed by the `Notebook`, then the `Editor`.

The tests are set up in a way that should make it _hopefully_ easy to
learn how to write a new opener. First to go after should probably be
image files.

Release Notes:

N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-03-14 18:01:40 -07:00
..
debounced_delay.rs Add debounce for re-querying completion documentation 2024-01-31 09:50:26 -05:00
lsp_command.rs Fall back to FindAllReferences if cmd-click did not preform GoToDefinition elsewhere (#9243) 2024-03-13 13:00:04 +02:00
lsp_ext_command.rs text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
prettier_support.rs Enable clippy::never_loop (#9006) 2024-03-14 14:07:50 -04:00
project.rs Foundations for Open All the Things (#9353) 2024-03-14 18:01:40 -07:00
project_settings.rs Add ability to specify binary path/args for rust-analyzer (#9293) 2024-03-13 18:42:03 +01:00
project_tests.rs Fix project search filtering on projects with multiple worktrees (#9337) 2024-03-14 16:40:48 +01:00
search.rs Do not start searching if query is empty (#9333) 2024-03-14 15:06:00 +01:00
task_inventory.rs Rename 'project_core' crate to 'worktree', make it just about worktrees (#9189) 2024-03-11 11:35:27 -07:00
terminals.rs Rename runnables into tasks (#8119) 2024-02-21 14:56:43 +02:00