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)
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)
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
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
* 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
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).
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
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))