Commit Graph

14099 Commits

Author SHA1 Message Date
Conrad Irwin
b2ae08b159 Implement an InputHandler trait for gpui2
Co-Authored-By: Marshall <marshall@zed.dev>
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Julia <julia@zed.dev>
2023-11-07 16:30:04 -07:00
Conrad Irwin
9cdfce4956
Make it possible to render a single line editor (#3259)
[[PR Description]]

Release Notes:

- (Added|Fixed|Improved) ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/community/issues/<public_issue_number_if_exists>)).
2023-11-07 14:26:10 -07:00
Conrad Irwin
5c450843a5 Add text and focus to editor 2023-11-07 14:19:15 -07:00
Conrad Irwin
a21c49c015 Make it possible to render a single line editor 2023-11-07 14:05:23 -07:00
Mikayla Maki
c7f5888348
editor singleline (#3257)
- Implement Editor::single_line
- Fix confusing error message
- Fix loading keyfiles
- Wire up GoToLine modal
2023-11-07 11:41:33 -08:00
Nate Butler
b692fb1464
Start documenting ThemeColors (#3258)
[[PR Description]]
- Adds doc comments for most fields on ThemeColors
- Scaffolds out some upcoming additional fields (Will add in a later PR)
- Renames a few fields:
    - `element_placeholder` -> `element_placeholder_text`
    - `element_drop_target` -> `drop_target_background`
- Removes the redundant `element_placeholder_text` (This should be set
using `text_placeholder`

Release Notes:

- N/A
2023-11-07 14:14:56 -05:00
Conrad Irwin
1e6a0f1c7b Wire up GoToLine modal 2023-11-07 12:12:05 -07:00
Conrad Irwin
0233864e92 Fix loading keyfiles 2023-11-07 12:04:37 -07:00
Conrad Irwin
b804b25c21 Fix confusing error message 2023-11-07 12:04:21 -07:00
Nate Butler
df84ba4222 Continue documenting theme colors 2023-11-07 14:04:09 -05:00
Nate Butler
eb5fe3a3b9 Merge branch 'main' into document-theme 2023-11-07 13:36:08 -05:00
Nate Butler
91f356a2f1 Begin documenting theme colors 2023-11-07 13:36:01 -05:00
Conrad Irwin
3a72f2122a Implement Editor::single_line 2023-11-07 11:12:36 -07:00
Antonio Scandurra
4bf3a4e3d4
Implement movement in editor2 (#3256)
Release Notes:

- N/A
2023-11-07 19:12:09 +01:00
Conrad Irwin
c89d6eb292
modals2 (#3247)
New Modal implementation for gpui2

Release Notes:

N/A
2023-11-07 10:56:46 -07:00
Antonio Scandurra
aa17adaac9 Merge remote-tracking branch 'origin/main' into editor-movement 2023-11-07 18:50:43 +01:00
Antonio Scandurra
d7e86eb1c1 Merge remote-tracking branch 'origin/main' into editor-movement 2023-11-07 18:48:08 +01:00
Marshall Bowers
25876161f8
theme_importer: Format generated themes (#3255)
This PR makes the `theme_importer` format the themes that it generates
automatically.

Release Notes:

- N/A
2023-11-07 12:45:09 -05:00
Antonio Scandurra
2697862a02 Merge remote-tracking branch 'origin/main' into editor-movement 2023-11-07 17:54:46 +01:00
Antonio Scandurra
82a018996b WIP 2023-11-07 17:54:14 +01:00
Antonio Scandurra
64b899c68c
Implement scrolling for editor2 (#3251)
Release Notes:

- N/A
2023-11-07 17:53:57 +01:00
Julia
5336c5decf
Re-introduce a macro for defining actions for ease of use (#3253)
Release Notes:

- N/A
2023-11-07 11:51:00 -05:00
Marshall Bowers
0d95410634
Rework third-party themes (#3254)
This PR reworks the way we define our third-party themes to make them
work as overlays on top of a base theme.

We introduce the concept of a `UserThemeFamily` that contains
`UserTheme`s. Rather than being an entire theme definition on their own,
a `UserTheme` just contains optional overrides for the values in a
`Theme`.

When resolving a `UserTheme`, we apply it on top of the base theme. Any
values not overridden in the `UserTheme` will fall back to the `Theme`
defaults.

Right now we are just using `UserTheme` to model third-party themes that
we distribute with the Zed binary. However, this same structure can also
be used to import arbitrary user themes (such as from a theme registry,
or even a theme blob from the settings file).

Release Notes:

- N/A
2023-11-07 11:40:07 -05:00
Julia
643146d768 Re-introduce a macro for defining actions for ease of use
Co-Authored-By: Piotr Osiewicz <piotr@zed.dev>
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
2023-11-07 11:30:58 -05:00
Conrad Irwin
a2a28af052 Add Modals
P.S. this is all completely different now

Co-Authored-By: Marshall <marshall@zed.dev>
Co-Authored-By: Julia <julia@zed.dev>
2023-11-07 09:18:34 -07:00
Piotr Osiewicz
9582a6f317
chore: Run multitarget build in script/bundle (#3241)
Ignore this PR for now.

This has a chance to speed up a build in case where e.g. we're
single-threaded in aarch64 build; at that point the x86_64 codegen can
take place. Also, MIR can probably be shared between the two
architectures, further reducing build time.

Release Notes:
- N/A
2023-11-07 17:00:36 +01:00
Conrad Irwin
2e43015664
gpui event test (#3249)
- Flesh out gpui2 test support
- Smoke test for event handling
2023-11-07 08:43:15 -07:00
Marshall Bowers
74853ea55f
Rename ThemeVariant to Theme (#3252)
This PR renames the `ThemeVariant` type to `Theme`.

This better reflects its purpose, as well as matches the same name as we
had before, which should make porting crates slightly easier.

Release Notes:

- N/A
2023-11-07 10:41:36 -05:00
Conrad Irwin
6f74854525 Fix event ordering issues 2023-11-07 08:29:55 -07:00
Antonio Scandurra
b0650517ad Clip text when scrolling horizontally
Co-Authored-By: Julia <julia@zed.dev>
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-07 15:50:18 +01:00
Antonio Scandurra
b9e98c112f Re-enable scrolling for EditorElement
Co-Authored-By: Julia <julia@zed.dev>
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-07 15:48:08 +01:00
Antonio Scandurra
9cb8512603
Start on laying out and painting editor2 (#3250)
![CleanShot 2023-11-07 at 13 16
28@2x](https://github.com/zed-industries/zed/assets/482957/a136a3d9-b518-4591-8307-e63cfe0e4310)


Release Notes:

- N/A
2023-11-07 15:14:26 +01:00
Marshall Bowers
7078c5fbb9 Regenerate all themes 2023-11-07 08:59:50 -05:00
Marshall Bowers
01eac50fc8 Add new ThemeColors values to the theme printer 2023-11-07 08:59:37 -05:00
Antonio Scandurra
9f2e6be1b3 Fix warning 2023-11-07 14:31:17 +01:00
Antonio Scandurra
268be71d8e Add colors for document highlights 2023-11-07 13:15:08 +01:00
Antonio Scandurra
bdf6e8bcc7 Merge remote-tracking branch 'origin/main' into editor2-paint 2023-11-07 13:09:48 +01:00
Antonio Scandurra
6ae09634ce Remove focused field and use FocusHandle instead in Editor 2023-11-07 12:46:31 +01:00
Antonio Scandurra
a866370dc1 Paint lines 2023-11-07 12:25:33 +01:00
Conrad Irwin
a7d52ee86f Smoke test for event handling 2023-11-06 21:05:22 -07:00
Conrad Irwin
8e799b6e22 Flesh out gpui2 test support 2023-11-06 21:05:11 -07:00
Conrad Irwin
2afeb50c4b
Try notarytool (#3239)
Try to use notarytool to fix build problems
2023-11-06 18:16:38 -07:00
Nate Butler
99a57d922f
Add theme importer (#3246)
[[PR Description]]

Thanks @maxdeviant for all the help with this one 🫂 

- Adds the `theme_importer` crate
- Adds the ability to import themes in VSCode Format.
- Adds the `assets/themes/src` folder with source files for imported
themes
- Adds an initial set of themes: `andromeda`, `ayu`, `dracula`,
`gruvbox`, `night-owl`, `noctis`, `palenight`, `rose-pine`, `solarized`,
`synthwave-84`.

From the README:

## Usage

- `cargo run -p theme_importer` - Import the context of
`assets/themes/src`

---

## Troubleshooting

As the importer generates rust files, you may need to manually do some
cleanup in `registry.rs` and `themes/mod.rs` if you remove themes or
delete the `themes` folder in the theme crate.

---

## Required Structure

To import a theme or series of themes 3 things are required:

- `family.json`: A JSON file containing the theme family metadata and
list of theme variants
- `{theme_name}.json`: One theme json for each theme variant
- `LICENSE`: A license file for the theme family

### `family.json`

#### `name`

The name of the theme family. Avoid special characters.

This will be used for the theme family directory name (lowercased) and
the theme family name in the Zed UI.

Good:

- `Rose Pine`
- `Synthwave 84`
- `Monokai Solarized`

Bad:

- `Rosé Pine`
- `Synthwave '84`
- `Monokai (Solarized)`

#### `author`

The author of the theme family. This can be a name or a username.

This will be used for the theme family author in the Zed UI.

#### `themes`

A list of theme variants.

`appearance` can be either `light` or `dark`. This will impact which
default fallback colors are used, and where the theme shows up in the
Zed UI.

### `{theme_name}.json`

Each theme added to the family must have a corresponding JSON file. This
JSON file can be obtained from the VSCode extensions folder (once you
have installed it.) This is usually located at `~/.vscode/extensions`
(on macOS).

You can use `open ~/.vscode/extensions` to open the folder in Finder
directly.

Copy that json file into the theme family directory and tidy up the
filenames as needed.

### `LICENSE`

A LICENSE file is required to import a theme family. Failing to provide
a complete text license will cause it to be skipped when the import is
run.

If the theme only provices a license code (e.g. MIT, Apache 2.0, etc.)
then put that code into the LICENSE file.

If no license is provided, either contact the theme creator or don't add
the theme.

---

### Complete Example:

An example family with multiple variants:

```json
{
  "name": "Ayu",
  // When both name and username are available
  // prefer the `username (name)` format
  "author": "dempfi (Ike Ku)",
  "themes": [
    {
      "name": "Ayu Light",
      "file_name": "ayu-light.json",
      "appearance": "light"
    },
    {
      "name": "Ayu Mirage",
      "file_name": "ayu-mirage.json",
      "appearance": "dark"
    },
    {
      "name": "Ayu Dark",
      "file_name": "ayu-dark.json",
      "appearance": "dark"
    }
  ]
}
```

An example single variant family:

```json
{
  "name": "Andromeda",
  "author": "Eliver Lara (EliverLara)",
  "themes": [
    {
      "name": "Andromeda",
      "file_name": "andromeda.json",
      "appearance": "dark"
    },
    {
      "name": "Andromeda Bordered",
      "file_name": "andromeda-bordered.json",
      "appearance": "dark"
    }
  ]
}
```


Release Notes:

- N/A
2023-11-06 16:08:05 -05:00
Nate Butler
eac7c3cea9 Update Cargo.toml 2023-11-06 16:02:21 -05:00
Nate Butler
2931d32499 Add a README for theme_importer 2023-11-06 16:00:57 -05:00
Nate Butler
3cb72610b3 Finish up initial themes 2023-11-06 15:24:36 -05:00
Nate Butler
62981fc2ee Format themes 2023-11-06 14:58:34 -05:00
Nate Butler
c47c64184c Add additional themes, update theme importer 2023-11-06 14:54:21 -05:00
Conrad Irwin
050d72719a
Use gpui instead of gpui2 consistently (#3245)
Release Notes:

N/A
2023-11-06 12:02:58 -07:00
Conrad Irwin
496518f3e8 Use gpui instead of gpui2 consistenytly 2023-11-06 11:50:33 -07:00