Commit graph

111 commits

Author SHA1 Message Date
Michael Sloan
f3fc4d6279
Add a CI check for todo! and FIXME comments (#21950)
Motivation for this is to support writing comments that will certainly
be revisited before merge.

Release Notes:

- N/A
2024-12-20 08:38:50 +00:00
Conrad Irwin
7425d242bc
Add telemetry::event! (#22146)
CC @JosephTLyons

Release Notes:

- N/A
2024-12-17 11:39:18 -07:00
Michael Sloan
fc5a810408
Add Corner to geometry and make names of corner methods consistent (#22119)
Release Notes:

- N/A
2024-12-16 22:57:15 -07:00
Michael Sloan
c5fe6ef100
Hide the implementation of Task (#22009)
The `Option<T>` within `Ready` is confusing and using `None` for it can
cause crashes. There was actually one instance of this!

Release Notes:

- N/A
2024-12-14 02:52:22 -07:00
Nate Butler
19d6e067af
Toggle & Switch (#21979)
![CleanShot 2024-12-13 at 11 27
39@2x](https://github.com/user-attachments/assets/7c7828c0-c5c7-4dc6-931e-722366d4f15a)

- Adds the Switch component
- Updates `Selected`, `Selectable` -> `ToggleState`, `Toggleable`
- Adds `checkbox` and `switch` functions to align better with other
elements in our layout system.

We decided not to merge Switch and Checkbox. However, in a followup I'll
introduce a Toggle or AnyToggle enum so we can update
`CheckboxWithLabel` -> `ToggleWithLabel` as this component will work
exactly the same with either a Checkbox or a Switch.

Release Notes:

- N/A
2024-12-13 14:23:02 -05:00
Kyle Kelley
0eb992219b
Set User Agent for Jupyter websocket connections (#21910)
Some VPN configurations require that websockets present a user agent.
This adds it in directly for the repl usage. I wish there was a way to
reuse the user agent from the `cx.http_client`, but I'm not seeing a
simple way to do that for the moment since it's not on the `HttpClient`
trait.

No release notes since this feature hasn't been announced/exposed.

Release Notes:

- N/A
2024-12-12 09:26:16 -08:00
Kyle Kelley
f8b6d71670
Optimize REPL kernel spec refresh (#21844)
Python kernelspec refresh now only performed on (known) python files. 

Release Notes:

- N/A
2024-12-11 06:20:44 -08:00
Kyle Kelley
579bc8f015
Upgrade repl dependencies (#21431)
Bump dependencies for jupyter packages. cc @maxdeviant 

Release Notes:

- N/A
2024-12-02 15:22:03 -08:00
Kirill Bulatov
28849dd2a8
Fix item closing overly triggering save dialogues (#21374)
Closes https://github.com/zed-industries/zed/issues/12029

Allows to introspect project items inside items more deeply, checking
them for being dirty.
For that:
* renames `project::Item` into `project::ProjectItem`
* adds an `is_dirty(&self) -> bool` method to the renamed trait
* changes the closing logic to only care about dirty project items when
checking for save prompts conditions
* save prompts are raised only if the item is singleton without a
project path; or if the item has dirty project items that are not open
elsewhere

Release Notes:

- Fixed item closing overly triggering save dialogues
2024-12-01 01:48:31 +02:00
Kyle Kelley
2177e833d8
Upgrade jupyter websocket client (#21095)
Upgrade to changes from https://github.com/runtimed/runtimed/pull/158 

Release Notes:

- N/A
2024-11-22 22:11:20 -08:00
Kyle Kelley
5766afe710
Pass through remote kernel's language on legacy selection (#21088)
When selecting an active kernel based on legacy usage, have remote
kernels defer to language within kernelspec.

Release Notes:

- N/A
2024-11-22 16:31:11 -08:00
Mikayla Maki
96854c68ea
Markdown preview image rendering (#21082)
Closes https://github.com/zed-industries/zed/issues/13246

Supersedes: https://github.com/zed-industries/zed/pull/16192

I couldn't push to the git fork this user was using, so here's the exact
same PR but with some style nits implemented.


Release Notes:

- Added image rendering to the Markdown preview

---------

Co-authored-by: dovakin0007 <dovakin0007@gmail.com>
Co-authored-by: dovakin0007 <73059450+dovakin0007@users.noreply.github.com>
2024-11-22 14:49:26 -08:00
Kyle Kelley
72613b7668
Implement RunningKernel trait for native and remote kernels (#20934)
This PR introduces a unified interface for both native and remote
kernels through the `RunningKernel` trait. When either the native kernel
or the remote kernels are started, they return a `Box<dyn
RunningKernel>` to make it easier to work with the session. As a bonus
of this refactor, I've dropped some of the mpsc channels to instead opt
for passing messages directly to `session.route(message)`. There was a
lot of simplification of `Session` by moving responsibilities to
`NativeRunningKernel`.

No release notes yet until this is finalized.

* [x] Detect remote kernelspecs from configured remote servers
* [x] Launch kernel on demand

For now, this allows you to set env vars `JUPYTER_SERVER` and
`JUPYTER_TOKEN` to access a remote server. `JUPYTER_SERVER` should be a
base path like `http://localhost:8888` or
`https://notebooks.gesis.org/binder/jupyter/user/rubydata-binder-w6igpy4l/`

Release Notes:

- N/A
2024-11-21 14:00:19 -08:00
张小白
95ace03706
windows: Set CREATE_NO_WINDOW for commands (#18447)
- Closes: #18371

Release Notes:

- N/A
2024-11-20 16:52:38 -08:00
Kyle Kelley
bd0f197415
Create RunningKernel trait to allow for native and remote jupyter kernels (#20842)
Starts setting up a `RunningKernel` trait to make the remote kernel
implementation easy to get started with. No release notes until this is
all hooked up.

Release Notes:

- N/A
2024-11-18 18:12:23 -08:00
Max Brunsfeld
093c9cc87b
Avoid creating occlusions for editor blocks, since these block mouse wheel events (#20649)
Just block mouse down events, and in the case of the inline assist
prompt, set the default cursor.

Release Notes:

- N/A

Co-authored-by: Richard <richard@zed.dev>
2024-11-13 21:02:54 -08:00
Kyle Kelley
b913cf2e02
Allow base64 encoded images to be decoded with or without padding (#20616)
The R kernel doesn't use base64 padding whereas the Python kernel (via
matplotlib) sometimes uses padding. We have to use the `base64` crate's
`Indifferent` mode.

/cherry-pick v0.161.x

Release Notes:

- N/A
2024-11-13 11:26:42 -08:00
Antonio Scandurra
92613a8904
Use replace blocks for patches (#20605)
Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
Co-authored-by: Richard <richard@zed.dev>
2024-11-13 18:55:23 +01:00
Kyle Kelley
466d3316a0
Fix issue with image output from Jupyter kernels that didn't use base64 padding (#20561)
Some checks are pending
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
This upgrades `nbformat` and `runtimelib` to handle jupyter types with
even more validation and flexiblity. This also processes any multiline
string data coming from the kernel, including with image data (like
`image/png`). While I was at it I also fixed a longstanding issue around
images by eliminating all whitespace (something `atob` does) and using
the no pad decoder.

Fixes: #17956

Before:

<img width="741" alt="image"
src="https://github.com/user-attachments/assets/37ec2cae-ce78-4475-aaa3-4d785e4015d0">

After:

<img width="727" alt="image"
src="https://github.com/user-attachments/assets/e2431ba2-048b-4205-9898-54f357795a9c">


Release Notes:

- Fixed issue with image output from REPL kernels that didn't use base64
padding
2024-11-12 16:25:49 -08:00
Kyle Kelley
97b542b22a
Discover available python environments with Jupyter kernel support (#20467)
![image](https://github.com/user-attachments/assets/7c042bc9-88be-4d7b-b63d-e5b555d54b18)

Closes #18291
Closes #16757
Closes #15563

Release Notes:

- Added support for kernelspecs based on python environments
2024-11-11 10:19:05 -08:00
Nate Butler
94d8ead270
Refactor Spacing into DynamicSpacing using proc macro (#20504)
Density tracking issue: #18078 

This PR refactors our spacing system to use a more flexible and
maintainable approach. We've replaced the static `Spacing` enum with a
dynamically generated `DynamicSpacing` enum using a proc macro.

Enum variants now use a `BaseXX` format, where XX = the pixel value @
default rem size and the default UI density.

For example:

`CustomSpacing::Base16` would return 16px at the default UI scale &
density.

I'd love to find another name other than `Base` that is clear (to avoid
base_10, etc confusion), let me know if you have any ideas!

Changes:

- Introduced a new `derive_dynamic_spacing` proc macro to generate the
`DynamicSpacing` enum
- Updated all usages of `Spacing` to use the new `DynamicSpacing`
- Removed the `custom_spacing` function, mapping previous usages to
appropriate `DynamicSpacing` variants
- Improved documentation and type safety for spacing values

New usage example:

```rust
.child(
    div()
        .flex()
        .flex_none()
        .m(DynamicSpacing::Base04.px(cx))
        .size(DynamicSpacing::Base16.rems(cx))
        .children(icon),
)
```

vs old usage example:

```
.child(
    div()
        .flex()
        .flex_none()
        .m(Spacing::Small.px(cx))
        .size(custom_spacing(px(16.)))
        .children(icon),
)
```

Release Notes:

- N/A
2024-11-11 11:08:55 -05:00
Kyle Kelley
1f974d074e
Set up editor actions after workspace not on stack (#20445)
Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad@zed.dev>
2024-11-08 17:11:43 -08:00
Kyle Kelley
706c385c24
Register repl actions with editor after session started (#20396)
Makes repl actions that are specific to running kernels only come up
after a session has been started at least once for the editor.

Release Notes:

- Only show session oriented `repl::` actions for editors after a
session has been created
2024-11-08 06:58:44 -08:00
Kyle Kelley
09675d43b3
Disable repl in non-local projects (#20397)
Release Notes:

- Disable REPL buttons and actions for remote projects and collaboration
(only the host should have access).
2024-11-08 06:29:07 -08:00
Kyle Kelley
36fe364c05
Show kernel options in a picker (#20274)
Closes #18341

* [x] Remove "Change Kernel" Doc link from REPL menu
* [x] Remove chevron
* [x] Set a higher min width
* [x] Include the language along with the kernel name

Future PRs will address

* Add support for Python envs (#18291, #16757, #15563)
* Add support for Remote kernels
* Project settings support (#16898)

Release Notes:

- Added kernel picker for repl

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2024-11-07 17:59:53 -08:00
Kyle Kelley
9dad897d49
Clean up notebook item creation in project (#20030)
* Implement `clone_on_split` to allow splitting a notebook into another
pane

* Switched to `tab_content` in `impl Item for NotebookEditor` to show
both the notebook name and an icon

* Added placeholder methods and TODOs for future work, such as saving,
reloading, and search functionality within the notebook editor.

* Started moving more core `Model` bits into `NotebookItem`, including
pulling the language of the notebook (which affects every code cell)

* Loaded notebook asynchronously using `fs`

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-10-31 07:01:46 -07:00
Kyle Kelley
7ce131aaf8
Trim whitespace from base64 encoded image data before decoding it (#19977)
Closes #17956
Closes #16330

This fix is for both REPL (released) and notebook (unreleased)

<img width="1210" alt="image"
src="https://github.com/user-attachments/assets/bd046f0f-3ad1-4c25-b3cb-114e008c2a69">

Release Notes:

- Fixed image support in REPL for certain versions of matplotlib that
included preceding and/or trailing whitespace in the base64 image data
2024-10-30 12:32:17 -07:00
Antonio Scandurra
c8003c0697
Take a mutable context when resolving selections (#19948)
This is a behavior-preserving change, but lays the groundwork for
expanding selections when the cursor lands inside of a "replace" block.

Release Notes:

- N/A
2024-10-30 15:21:51 +01:00
Lukas Geiger
83e2889d63
Fix notebook cell-height when soft-wrapping lines (#19933) 2024-10-30 07:12:32 -07:00
Kyle Kelley
6ea4662326
Initial Notebook UI structure (#19756)
This is the start of a notebook UI for Zed. 

`🔔 Note: This won't be useable yet when it is merged! Read below. 🔔`

This is going to be behind a feature flag so that we can merge this
initial PR and then make follow up PRs. Release notes will be produced
in a future PR.

Minimum checklist for merging this:

* [x] All functionality behind the `notebooks` feature flag (with env
var opt out)
* [x] Open notebook files in the workspace
* [x] Remove the "Open Notebook" button from title bar
* [x] Incorporate text style refinements for cell editors
* [x] Rely on `nbformat` crate for parsing the notebook into our
in-memory format
* [x] Move notebook to a `gpui::List`
* [x] Hook up output rendering


Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-10-29 11:30:07 -07:00
Max Brunsfeld
08a3c54bac
Allow editor blocks to replace ranges of text (#19531)
This PR adds the ability for editor blocks to replace lines of text, but
does not yet use that feature anywhere. We'll update assistant patches
to use replace blocks on another branch:
https://github.com/zed-industries/zed/tree/assistant-patch-replace-blocks

Release Notes:

- N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Richard Feldman <richard@zed.dev>
Co-authored-by: Marshall Bowers <marshall@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-10-25 12:29:25 +02:00
Max Brunsfeld
d209eab058
Combine excerpt footer and header into a single block (#19441)
Some checks are pending
CI / Check Postgres and Protobuf migrations, mergability (push) Waiting to run
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Linux) Build Remote Server (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
This simplifies rendering of excerpt headers and footers, and removes
the need to store a `BlockDisposition` on these boundary blocks. It's a
step toward implementing "replace blocks", which we want to use in the
assistant panel.

We've also cleaned up the way heights are specified for headers and
footers and fixed some visual asymmetries between the "expand upward"
and "expand downward" buttons.

Release Notes:

- N/A

---------

Co-authored-by: Richard <richard@zed.dev>
2024-10-18 17:58:07 -07:00
Albert Marashi
0070635b4d
Styling option for separating terminal view background from background color (#17611)
Closes #17313

Release Notes:

- Added theme styling option to separate terminal background view from
terminal background color, for transparent terminal backgrounds
2024-09-17 12:51:31 -04:00
Max Brunsfeld
bc5ed1334f
Upgrade tree sitter and all grammars (#17734)
Fixes https://github.com/zed-industries/zed/issues/5291

Release Notes:

- Fixed a bug where the 'toggle comments' command didn't use the right
comment syntax in JSX and TSX elements.

---------

Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2024-09-16 17:10:57 -07:00
Conrad Irwin
ca2cce79ed
ssh lsp completions (#17665)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
Release Notes:

* ssh-remoting: Fixed shell environment loading for remote shells.
2024-09-16 12:22:39 -06:00
Conrad Irwin
4d26f83d23
Revert "settings: Remove auxiliary Content types where possible (#16744)" (#17768)
This breaks setting `{"scrollbar": {"show":"never"}}`
Release Notes:

- N/A
2024-09-12 14:46:08 -04:00
Piotr Osiewicz
ccf6f27b8f
settings: Remove auxiliary Content types where possible (#16744)
Release Notes:

- N/A
2024-09-10 22:59:10 -04:00
Conrad Irwin
36eb1c15ea
use ssh lsp store (#17655)
Release Notes:

- ssh remoting: Added support for booting langauge servers (in limited
circumstances)

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-09-10 15:51:01 -04:00
Piotr Osiewicz
e6c1c51b37
chore: Fix several style lints (#17488)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
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
Kyle Kelley
02cd5128c7
repl: Make output buffer be readonly, never dirty (#17121) 2024-08-29 18:22:28 -07:00
Kyle Kelley
82ceb4c091
repl: Refactor outputs for externalization (#16971)
Working on addressing large outputs, refactored as part of it.



https://github.com/user-attachments/assets/48ea576c-e13a-4d09-b45a-4baa41bf6f72



Release Notes:

- N/A
2024-08-29 12:41:03 -07:00
Kyle Kelley
442ff94d58
Further document repl outputs (#16962)
Adding more docs to the repl outputs modules.

Release Notes:

- N/A
2024-08-27 12:34:16 -07:00
Kyle Kelley
26d943287b
REPL: Refactor output (#16927)
Shuffle `outputs.rs` into individual `outputs/*.rs` files and start
documenting them more.

Release Notes:

- N/A
2024-08-26 18:03:06 -07:00
Jason Lee
938d93a64c
gpui: Add truncate and text_ellipsis to TextStyle (#14850)
Release Notes:

- N/A

Ref issue #4996

## Demo

```
cargo run -p gpui --example text_wrapper 
```



https://github.com/user-attachments/assets/a7fcebf7-f287-4517-960d-76b12722a2d7

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-23 14:02:51 -04:00
Kyle Kelley
80c25960dd
repl: Set up a way to copy output from the REPL (#16649)
Closes #15494

Simple copy button to copy an individual output since selection is a bit
more work.

<img width="790" alt="image"
src="https://github.com/user-attachments/assets/4a7d8b69-70cc-428e-8fe3-b95386d341ee">


Release Notes:

- repl: Copy output from the REPL using a button

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-22 15:03:42 -07:00
Kyle Kelley
2ad9a742dd
repl: Add restart kernel action and improve shutdown (#16609)
- Implement restart kernel functionality
- Clean up shutdown process to properly drop messaging and exit status
tasks
- Refactor kernel state handling for better consistency

Closes #16037

Release Notes:

- repl: Added restart kernel action
- repl: Fixed issue with shutting down kernels that are in a failure
state
2024-08-21 11:51:58 -07:00
Marshall Bowers
f7f7cd5bb9
repl: Don't prefix free variables with _ (#16494)
This PR is a small refactor to remove the leading `_` for some free
variables, as this unintentionally marks them as unused to the compiler.

While the fields on the struct _are_ unused, the free variables should
participate in usage tracking, as we want to make sure they get stored
on the struct.

Release Notes:

- N/A
2024-08-19 19:15:27 -04:00
Kyle Kelley
f7f5a25584
repl: Apply border for error output on left (#16334)
Some checks are pending
CI / Check formatting and spelling (push) Waiting to run
CI / (macOS) Run Clippy and tests (push) Waiting to run
CI / (Linux) Run Clippy and tests (push) Waiting to run
CI / (Windows) Run Clippy and tests (push) Waiting to run
CI / Create a macOS bundle (push) Blocked by required conditions
CI / Create a Linux bundle (push) Blocked by required conditions
CI / Create arm64 Linux bundle (push) Blocked by required conditions
Deploy Docs / Deploy Docs (push) Waiting to run
Docs / Check formatting (push) Waiting to run
2024-08-16 00:31:46 -05:00
Kyle Kelley
da2bfbd29f
repl: Scale the text_style font_size and line_height (#16308)
Replaces #16273.

Release Notes:

- repl: Fixed scaling of stdout/stderr line heights

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Nate Butler <iamnbutler@gmail.com>
2024-08-15 18:46:36 -05:00
Richard Feldman
b1a581e81b
Copy/paste images into editors (Mac only) (#15782)
For future reference: WIP branch of copy/pasting a mixture of images and
text: https://github.com/zed-industries/zed/tree/copy-paste-images -
we'll come back to that one after landing this one.

Release Notes:

- You can now paste images into the Assistant Panel to include them as
context. Currently works only on Mac, and with Anthropic models. Future
support is planned for more models, operating systems, and image
clipboard operations.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Kyle <kylek@zed.dev>
2024-08-13 13:18:25 -04:00