Commit graph

10463 commits

Author SHA1 Message Date
Nate Butler
c5a42c317a
Remove unused color_scheme field in the theme (#2676)
We removed the `theme_testbench` crate a while back - It seems like that
was the only thing using the `color_scheme` field in the exported theme.

Removing this from the theme removes something like 42k lines of
generated JSON every time we build the theme (2k lines / 28% of the
total lines per generated theme!)

Release Notes:

- N/A (No public facing changes)
2023-07-04 00:58:37 -04:00
Nate Butler
a732b2e043 Remove unused color_scheme field in the theme
I totally didn't mean to commit this right to main T_T
2023-07-04 00:44:12 -04:00
Nate Butler
c409059dc4 Revert "Remove unused color_scheme field in the theme"
This reverts commit 5a1476a1e5.
2023-07-04 00:41:13 -04:00
Nate Butler
5a1476a1e5 Remove unused color_scheme field in the theme 2023-07-04 00:40:01 -04:00
Nate Butler
0b4c5db5e2
Use theme store to pass color_scheme directly to components (#2675)
This PR adds a theme store to allow components to directly access the
theme without requiring it to be passed down as props every time it is
used.

So before, you might need to do something like `text(theme, "variant",
"hovered")`, you could now just call `text("variant", "hovered")`.

This also means that style_trees don't need to be called with a theme
either:

```ts
export default function app(): any {
    const theme = useTheme()

    return {
        meta: {
            name: theme.name,
            is_light: theme.is_light,
        },
        command_palette: command_palette(),
        contact_notification: contact_notification(),
        // etc...
    }
}
```

We do this by creating a zustand store to store the theme, and allow it
to be accessed with `useThemeStore.getState().theme`.

```ts
import { create } from "zustand"
import { ColorScheme } from "./color_scheme"

type ThemeState = {
    theme: ColorScheme | undefined
    setTheme: (theme: ColorScheme) => void
}

export const useThemeStore = create<ThemeState>((set) => ({
    theme: undefined,
    setTheme: (theme) => set(() => ({ theme })),
}))

export const useTheme = (): ColorScheme => {
    const { theme } = useThemeStore.getState()

    if (!theme) throw new Error("Tried to use theme before it was loaded")

    return theme
}
```

Release Notes:

- N/A (No public facing changes)
2023-07-04 00:37:45 -04:00
Nate Butler
8a5e7047f0 Update a few more components 2023-07-04 00:32:27 -04:00
Nate Butler
d5acfe8fc1 Use theme store to pass color_scheme directly to components 2023-07-04 00:13:04 -04:00
Conrad Irwin
0733e8d50f Remove editor::Cancel binding from vim
When you hit <escape> in the command palette, it first editor::Cancel
because the command palette is also a focused editor; this binding was
catching before the `menu::Cancel` that you probably want.

From looking at the uses of editor::Cancel it seems like the only way to
trigger this is with <escape> in an editor. Rather than trying to hook
into the existing editor cancel and add vim-specific behaviour, we'll
instead take responsibility for binding directly to <escape> when
necessary.

Fixes: zed-industries/community#1347
2023-07-03 15:26:39 -06:00
Mikayla Maki
f8316dd127
Add sound effects to calls (#2673)
This PR adds joined, leaving, mute, and unmute sound effects to Zed. 

Release Notes:

- Added joined, leaving, mute, and unmute sound effects (preview-only)
2023-07-03 13:55:48 -07:00
Mikayla Maki
c700342a1c
Guard against uninstantiated globals in tests 2023-07-03 13:48:17 -07:00
Mikayla Maki
0e4c904091
Add joined sound effect when new participants join the room 2023-07-03 13:36:03 -07:00
Mikayla Maki
d2127825e3
Add first-pass sound support to Zed 2023-07-03 13:30:04 -07:00
Conrad Irwin
fe57e04016 vim: Allow ^ as a motion
Fixes: zed-industries/community#856
2023-07-03 12:55:41 -06:00
Conrad Irwin
b055f594b0 vim: ctrl-c to exit visual mode
Fixes: zed-industries/community#1447
Contributes: zed-industries/community#1089
2023-07-03 12:52:33 -06:00
Piotr Osiewicz
14eab4e94f branch list: dismiss correct window on PickerEvent.
Query proper window
2023-07-03 19:22:43 +02:00
Kirill Bulatov
6c01aeaf77
Do not perform OnTypeFormating after pair brace insert (#2672)
Closes
https://linear.app/zed-industries/issue/Z-2358/ra-brace-auto-surround-causes-duplicate-end-char-with-selection

Release Notes:

- Fixed a bug when duplicate brace appeared after selected text got
surrounded with braces
2023-07-03 17:26:55 +03:00
Piotr Osiewicz
806268f0db Merge branch 'main' into git-menu 2023-07-03 16:25:36 +02:00
Kirill Bulatov
85701c9b80 Do not perform OnTypeFormating after pair brace insert
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-07-03 17:21:44 +03:00
Piotr Osiewicz
4eedc3e646 Remove flex from underneath the pickers 2023-07-03 16:16:14 +02:00
Kirill Bulatov
8efb66be67
Do not add extra spaces to hints (#2671)
Closes
https://linear.app/zed-industries/issue/Z-2526/inlay-hints-in-typescript-types-have-extra-space-before#comment-ac88a101

Release Notes:

- N/A
2023-07-03 11:18:07 +03:00
Kirill Bulatov
43d4f04331 Do not add extra spaces to hints 2023-07-03 11:17:12 +03:00
Conrad Irwin
e36d5f41c8 Fix % when on the last character of the line
Contributes: zed-industries/community#682
2023-07-01 13:51:11 -06:00
Piotr Osiewicz
026ad191eb Dismiss dropdowns on click out 2023-07-01 01:49:00 +02:00
Piotr Osiewicz
525521eeb3 Render match count next to branch label 2023-07-01 01:38:36 +02:00
Mikayla Maki
138de37cbf
Add basic sound handling infrastructure 2023-06-30 16:10:49 -07:00
Kirill Bulatov
e017d62e92
Remove excessive hint update queries (#2667)
Closes
https://linear.app/zed-industries/issue/Z-2513/panic-in-refresh-inlay-hints

* Filter out queries for outdated buffers just before hint tasks spawn:
  multicaret edits might emit standalone events simultaneously
* Only spawn inlay update tasks for visible buffers with corresponding
  language
* Do not spawn tasks for local projects' buffers without LSP servers

Release Notes:

- N/A
2023-06-30 22:15:36 +03:00
Kirill Bulatov
ae54e1d224 Remove excessive hint update queries
* Filter out queries for outdated buffers just before hint tasks spawn:
  multicared edits might empit standalone events simultaneously
* Only spawn inlay update tasks for visible buffers with corresponding
  language
* Do not spawn tasks for local projects' buffers without LSP servers
2023-06-30 22:03:21 +03:00
Max Brunsfeld
f83514cde4
Fix regression in handling git FS events (#2670)
As part of an optimization in
https://github.com/zed-industries/zed/pull/2663, I changed the way that
the worktree ignores FS events within unloaded directories. But this
accidentally prevented us from detecting some events that occur inside
of `.git` directories.

In this PR, I've made further tweaks to which FS events we can ignore.
We now explicitly opt *in* to scanning `.git` (shallowly) directories
(even though they are ignored). Note that we still don't recursively
scan the git directory (including all of the files inside `objects`
etc). This seems like the correct amount of work to do, and from my
testing (and our unit tests that use the real FS and real git
repositories), it seems to work correctly.

Release Notes:

- Fixed a bug where Zed would not detect some git repository changes
(preview only).
2023-06-30 11:40:49 -07:00
Max Brunsfeld
92df76e632 Fix accidental ignoring of git FS events 2023-06-30 11:20:50 -07:00
Piotr Osiewicz
7c2c1a279b Add missing rust-side definitions 2023-06-30 20:09:30 +02:00
Piotr Osiewicz
cec884b5a5 Add styles for project name/git menu 2023-06-30 20:07:44 +02:00
Piotr Osiewicz
a5d9a10d7b Focus dropdowns on open 2023-06-30 19:48:28 +02:00
Joseph T. Lyons
6042cf928c
Fix bug preventing the assist command from working in certain keymaps (#2669)
Fixes: https://github.com/zed-industries/community/issues/1712

The keymaps were adding in a `"cmd-enter": "editor::NewlineBelow",`
entry in the context of `Editor`, and this was clobbering the assist
command in the assistant panel context. Zed now defines this command in
the default keymap under the context of `"context": "Editor && mode ==
full"`. All I needed to basically do was remove that command from the
keymaps. I also removed the `"cmd-shift-enter": "editor::NewlineAbove"
from the `Editor` context in those keymaps as wel, as it is also defined
in the default keymap.

Release Notes:

- Fix bug preventing the `assistant: assist` command from working in
certain keymaps
2023-06-30 13:32:42 -04:00
Joseph T. Lyons
4a654f5252 Fix bug preventing the assist command from working in certain keymaps 2023-06-30 13:27:48 -04:00
Mikayla Maki
a9c1395b9b
WIP: Add the ability to make new directories by adding slashes to a file name (#2638)
This PR adds a new way to make files / directories in the project panel,
by writing a path instead of a file.

TODO:
- [x] Solve a race condition that sometimes causes the newly created
file to not be selected / expanded correctly.
- [x] Change file refreshes to be minimal

Release Notes:

- Adds the ability to create new folders in the create-file action
([743](https://github.com/zed-industries/community/issues/743))
2023-06-30 07:46:32 -07:00
Piotr Osiewicz
ed75c31640 Improve styling of git menu 2023-06-30 16:38:38 +02:00
Piotr Osiewicz
b699e5c142 Add styles to git menu 2023-06-30 16:23:27 +02:00
Piotr Osiewicz
3be8977ee8 Switch branches within spawn() 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
c1a6292152 Add missing call to cx.notify 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
081e340d26 Do not query db on foreground thread.
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-06-30 14:05:55 +02:00
Piotr Osiewicz
818ddbc703 Make project dropdown exclusive wrt git menu 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
888d3b3fd6 Project dropdown menu 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
d000ea9739 Fix warning about unused variable 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
1eb0f3d091 Update toast for checkout failure 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
98f71a7fa3 Trail off project/branch name 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
e57364ede6 Remove unnecessary imports 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
aeafa6f6d6 Fix build after rebase 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
c84f3b3bfc Add toast for git checkout failure 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
54fad5969f List recent branches 2023-06-30 14:05:55 +02:00
Piotr Osiewicz
3027e4729a Add timestamps to branches 2023-06-30 14:05:55 +02:00