Commit Graph

10964 Commits

Author SHA1 Message Date
Conrad Irwin
5a711886d4 Refactor to make ModalLayer a View 2023-11-09 22:15:44 -07:00
Conrad Irwin
d4b1d1b528 Move from register_modals to register_workspace_action 2023-11-09 21:51:48 -07:00
Conrad Irwin
e6d6806693 Tidy up some more modal behaviour 2023-11-09 21:11:44 -07:00
Conrad Irwin
a73265ace4 Merge branch 'main' into command_palette2 2023-11-09 20:58:54 -07:00
Conrad Irwin
77d92ff65a Tidy up 2023-11-09 20:58:35 -07:00
Max Brunsfeld
b9e098ead8 Start work on creating gpui2 version of project panel 2023-11-09 16:51:03 -08:00
Marshall Bowers
cb8c534dac
theme_importer: Support importing themes containing comments (#3298)
This PR updates the `theme_importer` with support for parsing theme
files containing comments.

Up until now we've been manually removing comments from the VS Code
theme files.

Release Notes:

- N/A
2023-11-09 19:22:15 -05:00
Marshall Bowers
6bc1cf0fae
Re-import the Synthwave 84 theme (#3297)
This PR re-imports the Synthwave 84 theme now that we support 3-value
hex colors.

Release Notes:

- N/A
2023-11-09 18:56:42 -05:00
Max Brunsfeld
6f23894b40 Fix editor settings deserialization in editor2 2023-11-09 15:37:46 -08:00
Conrad Irwin
ff15ddf3e0 Render more than one item 2023-11-09 16:36:36 -07:00
Marshall Bowers
8bd02fdadc
Extend RGBA hex color parsing to support 3-value and 4-value variants (#3295)
This PR extends our support for parsing hex color codes to `Rgba` to
additionally support 3-value (`#rgb`) and 4-value (`#rgba`) formats.

See [here](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color)
for more details on these hex color variants.

Release Notes:

- N/A
2023-11-09 18:27:47 -05:00
Marshall Bowers
82861e3123 Improve digit duplication 2023-11-09 18:19:58 -05:00
Marshall Bowers
8f5adeb9c3 Improve error conditions when parsing hex colors 2023-11-09 18:00:17 -05:00
Marshall Bowers
417279e01b Add support for parsing 3-value and 4-value hex codes 2023-11-09 17:45:05 -05:00
Nate Butler
2347576fb5
Extend theme converter to allow multimatching against vscode colors (#3294)
[[PR Description]]

Adds the ability to specify a vec of VScode syntax scopes to match
against for a given syntax style.

Example:

```rust
pub fn to_vscode(&self) -> Vec<&'static str> {
        use ZedSyntaxToken::*;

        match self {
            SyntaxAttribute => vec!["entity.other.attribute-name"],
            SyntaxBoolean => vec!["constant.language"],
            SyntaxComment => vec!["comment"],
            SyntaxCommentDoc => vec!["comment.block.documentation"],
            SyntaxConstant => vec!["constant.character"],
            SyntaxConstructor => vec!["entity.name.function.definition.special.constructor"],
            SyntaxEmbedded => vec!["meta.embedded"],
            SyntaxEmphasis => vec!["markup.italic"],
            SyntaxEmphasisStrong => vec![
                "markup.bold",
                "markup.italic markup.bold",
                "markup.bold markup.italic",
            ],
            SyntaxEnum => vec!["support.type.enum"],
            SyntaxFunction => vec![
                "entity.name.function",
                "variable.function",
                "support.function",
            ],
            SyntaxKeyword => vec!["keyword"],
            SyntaxLabel => vec![
                "label",
                "entity.name",
                "entity.name.import",
                "entity.name.package",
            ],
            // .. more styles
}}
```

Useful `settings.json` for testing themes:

```json5
{
  // --- Dark Themes ---
  "theme": "Ayu Dark"
  // "theme": "Ayu Mirage"
  // "theme": "Dracula"
  // "theme": "Gruvbox Dark Hard"
  // "theme": "Gruvbox Dark Medium"
  // "theme": "Gruvbox Dark Soft"
  // "theme": "Night Owl"
  // "theme": "Noctis Obscuro"
  // "theme": "Noctis"
  // "theme": "Nord"
  // "theme": "Palenight (Mild Contrast)"
  // "theme": "Palenight Operator"
  // "theme": "Palenight"
  // "theme": "Rose Pine Moon"
  // "theme": "Rose Pine"
  // "theme": "Solarized Dark"
  // "theme": "Synthwave 84"
  // --- Light Themes ---
  // "theme": "Ayu Light"
  // "theme": "Gruvbox Light Hard"
  // "theme": "Gruvbox Light Medium"
  // "theme": "Gruvbox Light Soft"
  // "theme": "Noctis Lux"
  // "theme": "Rose Pine Dawn"
  // "theme": "Solarized Light"
}
```

Release Notes:

- N/A
2023-11-09 17:40:10 -05:00
Max Brunsfeld
b6eef26f91 Merge branch 'main' into search-query-suggestion-fixes 2023-11-09 14:18:17 -08:00
Conrad Irwin
fa153a0d56 Make command dispatching work 2023-11-09 15:14:23 -07:00
Max Brunsfeld
6b8ce3cc85 Add a setting for when to seed the search query from the text under the cursor 2023-11-09 14:03:14 -08:00
Nate Butler
6b65acaa99 regenerate themes, format 2023-11-09 16:48:35 -05:00
Nate Butler
024fb4f818 Remove unused import 2023-11-09 16:41:58 -05:00
Nate Butler
4cd37e6e62 Extend theme converter to allow multimatching against vscode colors 2023-11-09 16:38:48 -05:00
Max Brunsfeld
28d3d21108 Generalize Refineable derive macro to derive arbitrary traits on the refinement type 2023-11-09 13:23:31 -08:00
Max Brunsfeld
dba41e99dd Avoid suggesting search query if cursor is not on a word 2023-11-09 12:33:30 -08:00
Marshall Bowers
31a6409a4c
Refine theme styles (#3291)
This PR refines a number of styles in the default theme, as well as
updates the theme importer to support importing syntax styles from VS
Code themes.

Release Notes:

- N/A
2023-11-09 15:32:10 -05:00
Marshall Bowers
7b489f5e2e Allow user-theme related methods to be unused 2023-11-09 15:16:59 -05:00
Nathan Sobo
408a495aaf Call init 2023-11-09 13:14:11 -07:00
Nate Butler
1c6a960bbf Deal with special case where a VSCode theme doesn't have a foreground color
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 14:53:04 -05:00
Nate Butler
54157eb99a Finish passing Syntax from VSCode themes to Zed Themes
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 14:41:26 -05:00
Max Brunsfeld
c6b76d908f
Use normal JS comments within JSX tags and JSX expression blocks (#3290)
This fix only required changing the `overrides` queries for JavaScript
and TSX. I've made the fix in both the `zed2` and `zed` crates.

Release Notes:

- Fixed an issue in JavaScript and TSX files, where the 'toggle
comments' command used the wrong comment syntax inside of JSX tags and
expressions within JSX.
2023-11-09 11:15:08 -08:00
Max Brunsfeld
e50318e7e1 Duplicate buffer test changes in language2 version 2023-11-09 11:09:49 -08:00
Max Brunsfeld
4c89b2885e Use normal JS comments within JSX tags and JSX expression blocks
Co-authored-by: Kirill <kirill@zed.dev>
2023-11-09 10:58:33 -08:00
Nathan Sobo
f5f9d881d7 Polish actions macros 2023-11-09 11:57:13 -07:00
Nate Butler
ff053890cf Extend UserSyntax to allow font_style and font_weight to be specified
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 13:46:08 -05:00
Conrad Irwin
72de5cb6ce
Fix escape in GoToLine with new event emitter (#3289)
[[PR Description]]

Release Notes:

- N/A
2023-11-09 11:23:26 -07:00
Marshall Bowers
978cff8095 Use IndexMap for a deterministic order when importing syntax colors 2023-11-09 13:12:36 -05:00
Antonio Scandurra
1a0ddc424b WIP 2023-11-09 19:11:17 +01:00
Marshall Bowers
1f0fccc353 Reorganize theme_importer 2023-11-09 13:07:32 -05:00
Antonio Scandurra
b029083441 Start on rendering context menu in editor2
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Mikayla <mikayla@zed.dev>
2023-11-09 19:03:10 +01:00
Marshall Bowers
34e31fd489 Properly emit UserHighlightStyles 2023-11-09 12:59:20 -05:00
Conrad Irwin
3c689ba33e Fix escape in GoToLine with new event emitter 2023-11-09 10:52:17 -07:00
Piotr Osiewicz
a1d9f351db Some more woogaloo around action dispatch
Co-authored-by: Conrad <conrad@zed.dev>
2023-11-09 18:51:41 +01:00
Marshall Bowers
ff19a0ca18 Add importing-themes feature flag to theme2 crate
When this feature is set the `themes` module won't be compiled.
This allows us to run the `theme_importer` even when the `themes` module
has compile errors in it.
2023-11-09 12:49:16 -05:00
Marshall Bowers
60eae3e50a Emit unique highlights for each syntax token 2023-11-09 12:46:37 -05:00
Antonio Scandurra
5d15886675 Render code actions indicator
Co-Authored-By: Nathan <nathan@zed.dev>
2023-11-09 18:43:26 +01:00
Piotr Osiewicz
194d615691 Fix up keybindings propagation
Co-authored-by: Conrad <conrad@zed.dev>
2023-11-09 18:33:36 +01:00
Nate Butler
efd1db1b09 WIP – Add Syntax themes to importer
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 12:30:53 -05:00
Piotr Osiewicz
d184e0d426 Start working on command_palette2 2023-11-09 17:54:05 +01:00
Julia
9cb14c189b zed2: Get tsserver running again 2023-11-09 11:43:40 -05:00
Nate Butler
4b5ca3e420 Allow imported themes to refine StatusColors
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-09 11:30:59 -05:00
Antonio Scandurra
cfee1401ed Extract AnyElement::{measure,draw}
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2023-11-09 17:30:41 +01:00
Nate Butler
7253160b04 Add more vscode colors 2023-11-09 11:01:18 -05:00
Kirill Bulatov
b157453630
Do not use prettier for formatting node_modules/** files (#3286)
Fixes

> the most annoying thing i'm running into right now is that when i'm
patching something inside node_modules, Zed tries to pretty-format it
according to my prettier config. this messes up the patch because it has
formatting changes now. i need the pretty formatting on save to be off
inside node_modules, that never makes sense

feedback from #influencers 

Do note though, that language servers will still format any file inside
node_modules, but at least it's not prettier now.
VSCode seem to format the node_modules/** files via language servers
too, so that seems ok for now, and the rest could be fixed during

> "project diagnostics" (eslint) seem to be running inside node_modules,
e.g. i'm seeing 3182 "errors" in my project. that doesn't make sense and
probably wastes resources in addition to being annoying

feedback later.

Release Notes:

- Fixed prettier formatting files inside node_modules
2023-11-09 17:42:58 +02:00
Kirill Bulatov
f55d89088b Port changes to gpui2 2023-11-09 17:18:41 +02:00
Julia
27b3378020
Get tsserver running again (#3277)
Release Notes:

- Fixed a few issues preventing Javascript/Typescript language server
from working with latest upstream changes.
2023-11-09 10:14:36 -05:00
Kirill Bulatov
2e957bc564 Do not propose prettier formatters for documents in node_modules/ 2023-11-09 14:49:37 +02:00
Kirill Bulatov
ce40d5e0c5 Adjust the tests 2023-11-09 14:40:32 +02:00
Kirill Bulatov
8be07eddcc Change locate prettier method signature 2023-11-09 14:23:33 +02:00
Mikayla
656eb9d455
WIP 2023-11-09 00:18:00 -08:00
Mikayla
43eb7f28d1
checkpoint 2023-11-08 23:16:04 -08:00
Nate Butler
bdeb32c34b Extend VSCode theme importer 2023-11-09 01:39:31 -05:00
Nate Butler
25c8b19dfb WIP 2023-11-09 01:21:22 -05:00
Mikayla
f569628088
Merge branch 'more-gpui2-apis' into editor-tests 2023-11-08 22:19:11 -08:00
Mikayla
86630bbe59
Add extra clone 2023-11-08 22:16:08 -08:00
Mikayla
269c3ea244
Uncomment tests 2023-11-08 22:11:51 -08:00
Mikayla
7a7ef1025d
Add Context::read_window, WindowHandle::root, and change ViewContext.view() to return a reference 2023-11-08 22:11:19 -08:00
Nate Butler
b5f60b7e50 Merge branch 'main' into update-workspace-styles 2023-11-09 00:38:06 -05:00
Mikayla
4404e76a2d
Merge branch 'main' into editor-integration 2023-11-08 21:33:14 -08:00
Mikayla
0bfd18ba09
WIP 2023-11-08 21:32:59 -08:00
Mikayla Maki
ad3b0bd227
port notifications2 and integration tests (#3283)
Release Notes:

- N/A
2023-11-08 21:32:33 -08:00
Nathan Sobo
8c44f6a814
Simplify input handling (#3282)
This PR takes a different approach to input handling.

Rather than returning the optional input handler, focus handle pair from
the element trait, we instead allow you to register an input handler
imperatively on the window context with `WindowContext::handle_input`.
You pass a focus handle reference and any implementer of
`PlatformInputHandler`. There's an `ElementInputHandler<V>` that
implements `PlatformWindowHandler` so long as `V` implements
`InputHandler`.

Release Notes:

- N/A
2023-11-08 22:27:36 -07:00
Mikayla
7888dc4592
Add notifications2 2023-11-08 21:23:31 -08:00
Nathan Sobo
d52c5646b4 Add docs 2023-11-08 22:03:26 -07:00
Nathan Sobo
7c922ad6ee Remove comments 2023-11-08 21:49:21 -07:00
Nathan Sobo
8278a07354 Actually set the input handler 2023-11-08 21:43:14 -07:00
Mikayla Maki
8330fb5f10
port rope2 to zed2 (#3224)
port rope2 to zed2

Release Notes:

- NA
2023-11-08 20:19:05 -08:00
Mikayla
2c67cc80ba
Merge branch 'main' into event-emitter 2023-11-08 20:10:38 -08:00
Nathan Sobo
9a022671a2 Simplify IME support 2023-11-08 21:06:00 -07:00
Mikayla
3c57b912b9
Update editor to use new event emitter 2023-11-08 19:52:43 -08:00
Mikayla
a97c8bf58f
Get workspace compiling with new event emitters 2023-11-08 19:29:00 -08:00
Conrad Irwin
97ce9e9586
de-dbg (#3280)
Remove some debugging from GoToLine

Release Notes:

- N/A
2023-11-08 18:45:42 -07:00
Conrad Irwin
47a63d5cb7 de-dbg 2023-11-08 18:36:12 -07:00
Max Brunsfeld
4350801399 Merge branch 'main' into bounds-for-range 2023-11-08 17:31:00 -08:00
Max Brunsfeld
277fbda356 Fix vertical position in first_rect_for_character_range 2023-11-08 17:27:32 -08:00
Max Brunsfeld
86865431b9 Assign gutter widht on editor view when painting element 2023-11-08 17:01:50 -08:00
Mikayla
26fc36ee0e
First pass at allowing multiple event types to be emitted by an entity 2023-11-08 16:34:38 -08:00
Marshall Bowers
15f6fbf53b Merge branch 'bounds-for-range' of github.com:zed-industries/zed into bounds-for-range 2023-11-08 19:25:18 -05:00
Marshall Bowers
9a41c58779 Hard-code the gutter margin temporarily 2023-11-08 19:25:12 -05:00
Max Brunsfeld
b77fab0fae 🎨 2023-11-08 16:24:11 -08:00
Conrad Irwin
b90e34aeb2
go to line2 (#3261)
- MODAL
- center a div
- MOAR CODE
- Beautiful go to line modal


Release Notes:
- N/A
2023-11-08 17:16:00 -07:00
Max Brunsfeld
7a8f219251 Account for element's bounds in Editor::bounds_for_range
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-08 16:15:10 -08:00
Conrad Irwin
cef8fa5570 tidy tidy 2023-11-08 17:09:38 -07:00
Max Brunsfeld
1a37d9edc6 Register text input handlers via new element hook
Provide element bounds to the input handler's `bounds_for_rect` method.

Co-authored-by: Marshall <marshall@zed.dev>
2023-11-08 15:48:55 -08:00
Conrad Irwin
1b9f76c01d Refactor GoToLine to use cx.observe_new_views() 2023-11-08 16:23:05 -07:00
Max Brunsfeld
d273fa6dd0 Fix DisplaySnapshot::x_for_point always returning 0
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-08 13:55:39 -08:00
Max Brunsfeld
c81440424b
Fix blinking in editor2 (#3272)
This also introduces new APIs in `ViewContext` for observing window
focus changes.

Release Notes:

- N/A
2023-11-08 13:53:43 -08:00
Julia
c7139db39e Get tsserver running again 2023-11-08 16:51:54 -05:00
Conrad Irwin
cbdd4aca89 Merge branch 'main' into go-to-line2 2023-11-08 14:46:52 -07:00
Conrad Irwin
6a802e2fda Make Modals dismissable in theory 2023-11-08 14:45:54 -07:00
Nate Butler
e505fb330c WIP 2023-11-08 16:43:32 -05:00
Nate Butler
23a97f5b61
Document ColorScaleSteps (#3271)
[[PR Description]]

Adds documentation to ColorScaleSteps:

```rust
/// Returns the specified step in the [`ColorScale`].
    #[inline]
    pub fn step(&self, step: ColorScaleStep) -> Hsla {
        // Steps are one-based, so we need convert to the zero-based vec index.
        self.0[step.0 - 1]
    }

    /// `Step 1` - Used for main application backgrounds.
    ///
    /// This step provides a neutral base for any overlaying components, ideal for applications' main backdrop or empty spaces such as canvas areas.
    ///
    #[inline]
    pub fn step_1(&self) -> Hsla {
        self.step(ColorScaleStep::ONE)
    }

    /// `Step 2` - Used for both main application backgrounds and subtle component backgrounds.
    ///
    /// Like `Step 1`, this step allows variations in background styles, from striped tables, sidebar backgrounds, to card backgrounds.
    #[inline]
    pub fn step_2(&self) -> Hsla {
        self.step(ColorScaleStep::TWO)
    }

    /// `Step 3` - Used for UI component backgrounds in their normal states.
    ///
    /// This step maintains accessibility by guaranteeing a contrast ratio of 4.5:1 with steps 11 and 12 for text. It could also suit hover states for transparent components.
    #[inline]
    pub fn step_3(&self) -> Hsla {
        self.step(ColorScaleStep::THREE)
    }

    /// `Step 4` - Used for UI component backgrounds in their hover states.
    ///
    /// Also suited for pressed or selected states of components with a transparent background.
    #[inline]
    pub fn step_4(&self) -> Hsla {
        self.step(ColorScaleStep::FOUR)
    }

    /// `Step 5` - Used for UI component backgrounds in their pressed or selected states.
    #[inline]
    pub fn step_5(&self) -> Hsla {
        self.step(ColorScaleStep::FIVE)
    }

    /// `Step 6` - Used for subtle borders on non-interactive components.
    ///
    /// Its usage spans from sidebars' borders, headers' dividers, cards' outlines, to alerts' edges and separators.
    #[inline]
    pub fn step_6(&self) -> Hsla {
        self.step(ColorScaleStep::SIX)
    }

    /// `Step 7` - Used for subtle borders on interactive components.
    ///
    /// This step subtly delineates the boundary of elements users interact with.
    #[inline]
    pub fn step_7(&self) -> Hsla {
        self.step(ColorScaleStep::SEVEN)
    }

    /// `Step 8` - Used for stronger borders on interactive components and focus rings.
    ///
    /// It strengthens the visibility and accessibility of active elements and their focus states.
    #[inline]
    pub fn step_8(&self) -> Hsla {
        self.step(ColorScaleStep::EIGHT)
    }

    /// `Step 9` - Used for solid backgrounds.
    ///
    /// `Step 9` is the most saturated step, having the least mix of white or black.
    ///
    /// Due to its high chroma, `Step 9` is versatile and particularly useful for semantic colors such as
    /// error, warning, and success indicators.
    #[inline]
    pub fn step_9(&self) -> Hsla {
        self.step(ColorScaleStep::NINE)
    }

    /// `Step 10` - Used for hovered or active solid backgrounds, particularly when `Step 9` is their normal state.
    #[inline]
    pub fn step_10(&self) -> Hsla {
        self.step(ColorScaleStep::TEN)
    }

    /// `Step 11` - Used for text and icons requiring low contrast or less emphasis.
    #[inline]
    pub fn step_11(&self) -> Hsla {
        self.step(ColorScaleStep::ELEVEN)
    }

    /// `Step 12` - Used for text and icons requiring high contrast or prominence.
    #[inline]
    pub fn step_12(&self) -> Hsla {
        self.step(ColorScaleStep::TWELVE)
    }
```

Release Notes:

- N/A
2023-11-08 16:25:17 -05:00
Nate Butler
208f5f5182
Extend Styled for Zed-specific methods (#3276)
[[PR Description]]

- Adds `StyledExt` for Zed-specific methods like `ui_text`, `v_flex`,
etc.
- Updates components previously using `text_*` methods.

Release Notes:

- N/A
2023-11-08 16:04:46 -05:00
Mikayla
097efdebc5
WIP 2023-11-08 12:49:09 -08:00
Nate Butler
9cc3ee9674 Update usages of text_size_* to text_ui in ui components
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-08 15:28:38 -05:00
Nate Butler
9bdfc7a2e5 Update StyledExt to impl over I & F as well as V for Div
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-08 15:25:44 -05:00
Marshall Bowers
acf37804eb
Use a fork of ctor to silence warnings generated by macro (#3275)
This PR switches us over to a fork of `ctor` that contains the fixes
from https://github.com/mmastrac/rust-ctor/pull/295, backported to our
current version of `ctor` (v0.1.20).

Once 1) the `ctor` maintainer publishes a new version with that change
and 2) we're ready to upgrade to the latest version of `ctor` we can
switch back to the mainline version.

Release Notes:

- N/A
2023-11-08 15:05:19 -05:00
Nate Butler
f4abd95866 Remove the Stack trait, update StyledExt to include stacks
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-08 15:00:47 -05:00
Nate Butler
cb830a4ce0 Remove unused code in avatar 2023-11-08 14:46:47 -05:00
Nate Butler
4ef2f0b2b9 Update StyledExt to use more idiomatic method naming 2023-11-08 14:42:56 -05:00
Conrad Irwin
e90f6acf5f Silence problem 2023-11-08 12:37:35 -07:00
Conrad Irwin
dbe06fe5fc Merge branch 'main' into add-collab-tests 2023-11-08 12:33:15 -07:00
Mikayla
409e17ad30
Merge branch 'main' into go-to-line2 2023-11-08 11:32:36 -08:00
Nate Butler
6ecf629c63 BROKEN: Checkpoint 2023-11-08 14:29:38 -05:00
Mikayla
1864d37d2e
Fix double borrow in synchronous tests 2023-11-08 11:23:35 -08:00
Max Brunsfeld
2ac28240e4 Merge branch 'main' into picker-actions 2023-11-08 10:49:44 -08:00
Max Brunsfeld
4c31a0c989 Preserve stateless interactivity when assigning elements an id
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Piotr <piotr@zed.dev>
2023-11-08 10:45:10 -08:00
Mikayla
e1cb993878
Get tests green 2023-11-08 10:38:43 -08:00
Marshall Bowers
ca2cc42800 Remove unused SceneBuilder constructor 2023-11-08 13:30:20 -05:00
Antonio Scandurra
866df770cb Extract a Frame struct from Window
Co-Authored-By: Marshall <marshall@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-08 13:24:11 -05:00
Antonio Scandurra
14b41d657d Introduce ViewContext::on_blur
Co-Authored-By: Marshall <marshall@zed.dev>
2023-11-08 19:09:01 +01:00
Antonio Scandurra
2fd8b1f489 Fix blinking behavior in editor when receiving/losing focus
Co-Authored-By: Marshall <marshall@zed.dev>
2023-11-08 19:03:57 +01:00
Nate Butler
e4ca2cb20b Update titlebar 2023-11-08 12:57:31 -05:00
Nate Butler
6e11044e9e add ui_text_size functions 2023-11-08 12:57:24 -05:00
Mikayla
9b30f490c7
Merge branch 'main' into add-collab-tests 2023-11-08 09:57:08 -08:00
Mikayla
3050c440f4
Merge branch 'main' into add-collab-tests 2023-11-08 09:41:57 -08:00
Max Brunsfeld
d25f48ed6b Register menu2 actions using actions macro 2023-11-08 09:35:19 -08:00
Antonio Scandurra
738b2ce6c5 Extract a Frame struct from Window
Co-Authored-By: Marshall <marshall@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-08 18:17:38 +01:00
Antonio Scandurra
0143fa2056
Fix clipping bugs in editor2 (#3269)
Release Notes:

- N/A
2023-11-08 17:51:39 +01:00
Marshall Bowers
761d4fcd49
Port the picker and uniform list (#3248)
This adds a `UniformList` element and partially implements `Picker` as a
component, using `UniformList`. Because editor2 isn't fully implemented
yet, the picker doesn't have filtering logic yet. We want to merge this
for now though, to make the UniformList element available for other
crates.

Release Notes:

- N/A
2023-11-08 17:45:23 +01:00
Marshall Bowers
b6766ba39a
Replace GitStatusColors with StatusColors (#3268)
This PR removes `GitStatusColors` in favor of just using `StatusColors`
instead.

Release Notes:

- N/A
2023-11-08 11:32:32 -05:00
Antonio Scandurra
d71f671476 Fix clipping in Line::draw
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Marshall <marshall@zed.dev>
2023-11-08 17:32:21 +01:00
Antonio Scandurra
727fb4fbff Use a consistent clipping strategy for drawing all the primitives
Co-Authored-By: Nathan <nathan@zed.dev>
2023-11-08 17:29:05 +01:00
Marshall Bowers
e9650c025f Fix overflow in UniformList 2023-11-08 11:26:26 -05:00
Marshall Bowers
fe28d8faea Merge branch 'main' into picker 2023-11-08 11:18:54 -05:00
Joseph T. Lyons
9e5a4ea6c4 v0.113.x dev 2023-11-08 10:53:37 -05:00
Antonio Scandurra
55dca1e3e1 💄 2023-11-08 15:33:11 +01:00
Antonio Scandurra
15d40d6df5 Determine whether the gutter was hovered 2023-11-08 15:30:41 +01:00
Antonio Scandurra
dfc536b4f5 Handle MouseUpEvent in editor2 2023-11-08 15:17:30 +01:00
Antonio Scandurra
e500c05880 Move building of key listeners outside of EditorElement::initialize 2023-11-08 15:12:54 +01:00
Antonio Scandurra
bef3b80bd4 Clear hover background highlights
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-08 15:08:54 +01:00
Piotr Osiewicz
e5f78ec122 Uncomment mouse_dragged event
Co-authored-by: Antonio <antonio@zed.dev>
2023-11-08 15:02:35 +01:00
Piotr Osiewicz
1b085bd618 Extract mouse event handlers into paint_mouse_listeners
Co-authored-by: Antonio <antonio@zed.dev>
2023-11-08 14:40:08 +01:00
Piotr Osiewicz
dd20032eab Hook up mouse_down function handler
Co-authored-by: Antonio <antonio@zed.dev>
2023-11-08 14:36:05 +01:00
Piotr Osiewicz
e30449e61a Pass text_bounds instead of full editor bounds into mouse_moved.
Co-authored-by: Antonio <antonio@zed.dev>
2023-11-08 14:28:16 +01:00
Piotr Osiewicz
334829f868 uncomment show_hover 2023-11-08 14:24:28 +01:00
Piotr Osiewicz
cd3773531c uncomment mouse moved 2023-11-08 14:24:28 +01:00
Antonio Scandurra
e4bc03217d
gpui2: Type-erase futures. (#3266)
Project2's LLVM IR size is ~33-44% bigger than project1 due to the fact
that in gpui2 we call async_task::spawn(_local) with impl Future instead
of dyn Future, which leads to quite a few more instantiations of
RawTask.

LLVM-IR size for project2:
|  build_type  |  main   |  this branch  | project1 |
|  debug       | 2617795 |    2022814    | 1817866  |
|  release     | 4439033 |    3715086    | 3314489  |

Note that this PR is in line with what was done in GPUI1 (we've also
boxed futures there).
Release Notes:

- N/A
2023-11-08 14:21:40 +01:00
Piotr Osiewicz
2364f6b22e gpui2: Type-erase futures.
Project2's LLVM IR size is ~20-25% bigger than project1 due to the fact that in gpui2 we call async_task::spawn(_local) with impl Future instead of dyn Future, which leads to quite a few more instantiations of RawTask.

LLVM-IR size for project2:
|  build_type  |  main   |  this branch  | project1 |
|  debug       | 2617795 |    2022814    | 1817866  |
|  release     | 4439033 |    3715086    | 3314489  |
2023-11-08 13:06:28 +01:00
Antonio Scandurra
c5d5571ad3 Fix warnings when generating function name for ctor
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-08 12:31:35 +01:00
Antonio Scandurra
6a0789c88e Don't alpha blend when rasterizing paths
Co-Authored-By: Piotr <piotr@zed.dev>
2023-11-08 12:04:25 +01:00
Antonio Scandurra
8ac8a6f1d9 Re-enable most of the functionalities in editor2 2023-11-08 11:30:32 +01:00
Nate Butler
31bac3dd62 Document ColorScaleSteps 2023-11-08 00:45:05 -05:00
Nathan Sobo
408edaae39 Remove call to removed method 2023-11-07 21:58:46 -07:00
Nathan Sobo
1949fa5147 Merge remote-tracking branch 'origin/main' into register-actions 2023-11-07 21:56:08 -07:00
Nathan Sobo
2a55b0dbfb Simplify actions macro. 2023-11-07 21:48:47 -07:00
Nathan Sobo
fdc9ea7f9b Docs and cleanup 2023-11-07 21:26:51 -07:00
Nathan Sobo
814e62050c Register actions globally before main 2023-11-07 20:58:37 -07:00
Nathan Sobo
80630cd4d9 WIP 2023-11-07 20:23:02 -07:00
Nate Butler
0dd6ea6d41 Add new default player colors and the players story. 2023-11-07 21:51:12 -05:00
Nate Butler
79b4f78cb3 Extend the theme crate to enable stories, add players story 2023-11-07 21:08:33 -05:00
Nate Butler
a39865b4b2 Update default player colors 2023-11-07 20:27:00 -05:00
Max Brunsfeld
06960df287 Implement basic fuzzy filtering in picker 2023-11-07 17:24:04 -08:00
Max Brunsfeld
bdec1c8202 Merge branch 'main' into picker 2023-11-07 16:57:47 -08:00
Max Brunsfeld
9fe3073af7 Get basic text input working
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 16:33:02 -08:00
Max Brunsfeld
bd12e3edb6 Assign editors as text input handlers
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 15:44:00 -08:00
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
7cdece4857 Beautiful go to line modal
Co-authored-by: Julia <julia@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 15:32:34 -07:00
Max Brunsfeld
ea603401e2 Get actions + focus working on picker, now that it's a view
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 13:48:32 -08:00
Conrad Irwin
ae2d0f1fa1 Merge branch 'main' into go-to-line3 2023-11-07 14:44:45 -07:00
Conrad Irwin
5751303ea4 MOAR CODE 2023-11-07 14:44:36 -07:00
Max Brunsfeld
36d9633f6f Merge branch 'main' into picker 2023-11-07 13:37:49 -08:00
Max Brunsfeld
b9d051eae7 Start work on adding a filter editor to the picker
Implement picker as a view instead of as a component

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-07 13:37:10 -08:00
Nate Butler
3a85beeaa5 center a div 2023-11-07 16:23:41 -05: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
Max Brunsfeld
80e6427eec 🎨
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-07 13:03:36 -08:00
Conrad Irwin
acab2f9003 MODAL 2023-11-07 13:23:27 -07:00
Max Brunsfeld
10c94cc8b7 Remove unused import 2023-11-07 11:47:49 -08:00
Mikayla Maki
a3bd04fed2
Merge branch 'main' into picker 2023-11-07 11:44:02 -08: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
Max Brunsfeld
d690fb038d Merge branch 'main' into picker 2023-11-07 11:27:14 -08: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
Max Brunsfeld
6928ad1335 Rename List -> UniformList
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-07 11:00:53 -08:00
Max Brunsfeld
2412873719 Remove commented-out code in picker2
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-07 10:53:59 -08:00
Max Brunsfeld
742180a3a8 Implement list scroll tracking
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-07 10:45:38 -08: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
Max Brunsfeld
1d34b7b9fe Implement picker actions
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-11-07 09:46:41 -08: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
Max Brunsfeld
69eb49a2ed Merge branch 'main' into picker 2023-11-07 09:34:57 -08: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
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
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
Mikayla
85000eba81
wip: picker
co-authored-by: nathan <nathan@zed.dev>
co-authored-by: max <max@zed.dev>
2023-11-06 17:09:38 -08:00
Mikayla
3c93b585ab
Checkpoint 2023-11-06 15:11:22 -08:00
Mikayla
ea6755b1ca
Checkpoint 2023-11-06 14:26:10 -08: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
Mikayla
3f7dc59512
Snapshot for kirill 2023-11-06 12:33:20 -08: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
Mikayla
75a80811b3
WIP 2023-11-06 11:18:56 -08:00
Conrad Irwin
496518f3e8 Use gpui instead of gpui2 consistenytly 2023-11-06 11:50:33 -07:00
Conrad Irwin
eb325fb387
editor2 rendering (#3244)
- Make tab bar visible
- Fix tab text colors
- Ensure panes cover the available space
- Make the close button close
- Fix bug when unsubscribe called after remove
- WIP: start on editor element
- Add hover behaviour to tabs
- Add PointingHand on tabs
- gpui2: Add on_hover events
- Tooltip on tabs
- MOAR TOOLTIPS
- Use an `IconButton` for the tab close button
- Remove unneeded type qualification
- Tooltips in mouse event handler & fix executor timer
- Move more tooltip logic into gpui2 & fix tooltip moving on paint
- Update tooltip code a bit
- Allow multiple subscriptions from one entity handle

Release Notes:

- N/A
2023-11-06 11:29:42 -07:00
Marshall Bowers
d224f511fa
Add interactivity to Checkbox component (#3240)
This PR adds interactivity to the `Checkbox` component.

They can now be checked and unchecked by clicking them.

Release Notes:

- N/A
2023-11-06 13:22:25 -05:00
Mikayla
d66ed4310f
WIP: change over background executor test helpers 2023-11-06 10:16:08 -08:00
Conrad Irwin
c59817cd72 Merge branch 'main' into editor2-rendering 2023-11-06 11:06:43 -07:00
Conrad Irwin
d88dccffbc Allow multiple subscriptions from one entity handle 2023-11-06 11:03:14 -07:00
Antonio Scandurra
e460f6a27c WIP 2023-11-06 18:59:46 +01:00
Conrad Irwin
3afdeeac1e
tooltip2 (#3237)
- Fix executor.timer() in gpui2
- Add support for tooltips 

[[PR Description]]

Release Notes:

- N/A
2023-11-06 10:51:01 -07:00
Nate Butler
80f80df5cf Add Noctis Theme 2023-11-06 12:43:10 -05:00
Kirill Bulatov
254b369624
Properly toggle diagnostics (#3243)
Follow-up of https://github.com/zed-industries/zed/pull/3236 that fixes
a bug introduced in that PR: diagnostics warning toggle stopped working.

Release Notes:

- N/A
2023-11-06 19:35:49 +02:00
Kirill Bulatov
bfb860c06c Properly toggle diagnostics 2023-11-06 19:29:31 +02:00
Marshall Bowers
f8504c349c Merge branch 'main' into import-theme 2023-11-06 12:08:46 -05:00
Marshall Bowers
bf80c1da5b
Rename fields in ThemeColors (#3242)
This PR applies a number of field renames in the `ThemeColors` struct
from the `import-theme` branch.

This will help prevent this branch from diverging too far from `main`.

Release Notes:

- N/A

---------

Co-authored-by: Nate Butler <iamnbutler@gmail.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-06 11:53:27 -05:00
Julia
66b967532f zed2: Actually find downloaded binary in Elixir cached binary method 2023-11-06 11:31:31 -05:00
Julia
dbdb5f6519 Actually find downloaded binary in Elixir cached binary method 2023-11-06 11:18:36 -05:00
Nate Butler
8192a52bd0 Skip .DS_Store files when scanning themes folder 2023-11-06 11:03:17 -05:00
Nate Butler
5c24c931c5 Remove unused file 2023-11-06 10:57:25 -05:00
Antonio Scandurra
769526a76a Paint editor background 2023-11-06 15:54:09 +01:00
Kirill Bulatov
128d3696ad
More heuristics for diagnostics updates (#3236)
Follow-up of https://github.com/zed-industries/zed/pull/3225
That PR enabled every `project::Event::DiskBasedDiagnosticsFinished` to
update the diagnostics, which turned out to be bad, Zed does query for
more diagnostics after every excerpt update, and that seems to be due to
`Event::Edited` emitted by the multibuffers created in the diagnostics
panel.

* now, instead of eagerly updating the diagnostics every time, only do
that if the panel has 0 or 1 caret placed and no changes were made in
the panel yet.
Otherwise, use previous approach and register the updated paths to defer
their update later.

* on every `update_excerpts` in the diagnostics panel, query the entire
diagnostics summary (and store it for the future comparisons), compare
old and new summaries and re-query diagnostics for every path that's not
in both summaries.
Also, query every path that was registered during the
`DiskBasedDiagnosticsFinished` updates that were not eagerly updated
before.

This way we're supposed to get all new diagnostics (for new paths added)
and re-check all old paths that might have stale diagnostics now.

* do diagnostics rechecks concurrently for every path now, speeding the
overall process

Release Notes:

- Fixed diagnostics triggering too eagerly during multicaret edits and
certain stale diagnostics not being removed in time
2023-11-05 16:17:38 +02:00
Kirill Bulatov
ad93d9132f Correctly update old diagnostics 2023-11-05 15:37:27 +02:00
Kirill Bulatov
fdcb907644 Parallelize diagnostics filling, add more logs 2023-11-05 15:06:39 +02:00
Kirill Bulatov
ff1d692e46 Restructure inner path data 2023-11-05 14:53:13 +02:00
Kirill Bulatov
7145fabb6d Eagerly refresh diagnostics that do not intercept with user input 2023-11-05 14:44:22 +02:00
Kirill Bulatov
660c3371e4 Refresh all possibly stale diagnostics pat 2023-11-05 14:43:54 +02:00
Nate Butler
1bce5dcc69 Add checkboxes and their stories 2023-11-05 01:06:41 -05:00
Nate Butler
b125cc279f Simplify toggle, do some reorganization 2023-11-04 11:24:31 -04:00
Antonio Scandurra
86d1defda2 Fix compile errors, now lines are being laid out 2023-11-04 14:37:57 +01:00
Kirill Bulatov
9f40a5c53f Suppress unused vars warning generated by gpui macro 2023-11-04 13:54:37 +02:00
Conrad Irwin
de5458cfe0 Update tooltip code a bit
This fixes a tiny UX bug where the tooltip would appear to move if you
hovered over an element, then moved your mouse out and back within
500ms.

The fix is to retain the task, so we can drop it to cancel it when the
mouse leaves.

Also changes the time we construct the tooltip to the time it first
shows.
2023-11-03 21:40:28 -06:00
Mikayla Maki
123439adc2
Merge branch 'main' into add-collab-tests 2023-11-03 18:06:08 -07:00
Mikayla
e1525e2b47
Get collab2 green 2023-11-03 18:01:06 -07:00
Max Brunsfeld
436dc93441 WIP2000 2023-11-03 16:40:37 -07:00
Max Brunsfeld
2dd32dbe87 Allow language injection in markdown code blocks in channel notes 2023-11-03 15:53:54 -07:00
Julia
4725cd2cd6 Move more tooltip logic into gpui2 & fix tooltip moving on paint
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
2023-11-03 18:37:15 -04:00
Nate Butler
b0d202ba5e Merge branch 'main' into add-ui-docs 2023-11-03 18:20:17 -04:00
Nate Butler
9ce7199d2d Add some initial docs 2023-11-03 18:19:54 -04:00
Marshall Bowers
5d36331942
storybook2: Remove unreferenced components module (#3229)
This PR removes the `components` module from `storybook2` as it was
dead, unreferenced code.

Release Notes:

- N/A
2023-11-03 18:12:21 -04:00
Julia
3834e26f71 Tooltips in mouse event handler & fix executor timer
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
2023-11-03 18:02:58 -04:00
Marshall Bowers
76db100d11
ui2: Reorganize components (#3228)
This PR reorganizes the components in the `ui2` crate.

The distinction between "elements" and "components" is now gone, with
all of the reusable components living under `components/`.

The components that we built while prototyping but will eventually live
in other crates currently reside in the `to_extract/` module.

Release Notes:

- N/A
2023-11-03 17:34:11 -04:00
Marshall Bowers
287ea0a6e4
Allow deriving Serialize and Deserialize on generated refinement (#3227)
This PR adds support for deriving `Serialize` and `Deserialize` on the
refinement type generated by `#[derive(Refineable)]`.

Release Notes:

- N/A
2023-11-03 17:21:00 -04:00
Marshall Bowers
b5224bdafd Remove unneeded type qualification 2023-11-03 16:40:46 -04:00
Nate Butler
d500b01aed Add docs burndown list
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-03 16:37:22 -04:00
Marshall Bowers
1361b61708 Use an IconButton for the tab close button 2023-11-03 16:36:02 -04:00
Nate Butler
740e2cc5bf Start on ui root doc
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2023-11-03 16:28:54 -04:00
Conrad Irwin
f97046b86f MOAR TOOLTIPS 2023-11-03 14:15:32 -06:00
Kirill Bulatov
edacffab58
Refresh diagnostics inside the tab (#3225)
r-a now has 2 different types of diagnostics: 
* "disk-based" ones that come from `cargo check` and related, that emit
`project::Event::DiskBasedDiagnosticsStarted` and
`DiskBasedDiagnosticsFinished`
* "flycheck" diagnostics from r-a itself, that it tries to dynamically
apply to every buffer open, that come with `DiagnosticsUpdated` event.

Latter diagnostics update frequently, on every file close and open, but
`diagnostics.rs` logic had never polled for new diagnostics after
registering the `DiagnosticsUpdated` event, so the only way we could
have newer diagnostics was to re-open the whole panel.
The PR fixes that, and also adds more debug logging to the module.
The logic of the fix looks very familiar to previous related fix:
https://github.com/zed-industries/zed/pull/3128

One notable thing after the fix: "flycheck" diagnostics stay forever if
the diagnostics panel is opened: excerpts in that panel do not allow the
buffer to get dropped (hence, closed in terms of r-a) and get the
updated, zero diagnostics.
If the diagnostics panel is opened and closed multiple times, those
errors gradually disappear.

Release Notes:

- Fixed diagnostics panel not refreshing its contents properly
2023-11-03 22:03:05 +02:00
Conrad Irwin
33245d119e Tooltip on tabs
Co-Authored-By: Julia <julia@zed.dev>
2023-11-03 14:02:46 -06:00
Kirill Bulatov
918d123284 Fix the test 2023-11-03 21:51:12 +02:00
Kirill Bulatov
6f8947a3d3 Fix a compilation error 2023-11-03 21:51:12 +02:00
Kirill Bulatov
9cb8ce172d Refresh diagnostics inside the tab 2023-11-03 21:51:12 +02:00
Marshall Bowers
12500364b4 Merge branch 'main' into import-theme 2023-11-03 15:41:12 -04:00
Marshall Bowers
fa7d6c0e70
Remove Default impl for ThemeColors` (#3226)
This PR removes the `Default` impl for `ThemeColors`.

Since we need default light and dark variants for `ThemeColors`, we
can't use a single `Default` impl.

Release Notes:

- N/A
2023-11-03 15:40:50 -04:00
Max Brunsfeld
66499f60ee Fix double borrow in synchronous tests that take AppContext
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2023-11-03 12:10:11 -07:00
Mikayla
2b883bf32e
WIP 2023-11-03 12:04:24 -07:00
Conrad Irwin
26e64fb843 gpui2: Add on_hover events 2023-11-03 12:51:38 -06:00
Antonio Scandurra
2a672e2126 WIP 2023-11-03 18:55:20 +01:00
Mikayla
6a1fb18334
Update to latest patterns for porting work 2023-11-03 10:46:47 -07:00
Max Brunsfeld
b085569b46
Add channel2 crate
Co-authored-by: Marshall <marshall@zed.dev>
2023-11-03 10:41:41 -07:00
Conrad Irwin
d73c54f604 Add PointingHand on tabs 2023-11-03 11:30:15 -06:00
Conrad Irwin
c604a2e34e Add hover behaviour to tabs
Co-Authored-By: Marshall <marshall@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>
2023-11-03 10:55:07 -06:00
KCaverly
a65c1776d8 port rope2 to zed2 2023-11-03 12:15:23 -04:00
Antonio Scandurra
d3b02c4de4 WIP: start on editor element 2023-11-03 17:14:17 +01:00
Conrad Irwin
580694dbda Fix bug when unsubscribe called after remove
Co-Authored-By: Julia <julia@zed.dev>
2023-11-03 09:56:35 -06:00
Conrad Irwin
920ea1bf0a Make the close button close 2023-11-03 09:20:27 -06:00
Antonio Scandurra
b5c2cf371a Ensure panes cover the available space 2023-11-03 16:14:03 +01:00
Conrad Irwin
0edcec7c4e Fix tab text colors 2023-11-03 09:12:12 -06:00
Marshall Bowers
363d7c6634 Exclude source themes from Zed2 binary 2023-11-03 11:11:10 -04:00
Kyle Caverly
343525d77b
added workspace event for WorkspaceCreated (#3222)
added workspace2 event for WorkspaceCreated

Release Notes:

- NA
2023-11-03 11:06:11 -04:00
Marshall Bowers
acc36e6dab Update emitted module import 2023-11-03 10:58:06 -04:00
Marshall Bowers
293fbe4c75 Account for colors in VS Code theme being optional 2023-11-03 10:54:12 -04:00
Antonio Scandurra
b21c25826d Make tab bar visible 2023-11-03 15:51:33 +01:00