This PR adds a `darken` function that allows to reduce the lightness of
a color by a certain factor. This popped up as I wanted to add hover
styles to tinted-colors buttons.
Release Notes:
- N/A
This PR reverts #20076 to turn the `ThemeRegistry` back into a regular
struct again.
It doesn't actually help us by having it behind a trait.
Release Notes:
- N/A
This PR converts the `ThemeRegistry` type into a trait instead of a
concrete implementation.
This allows for the extension store to depend on an abstraction rather
than the concrete theme registry implementation.
We currently have two `ThemeRegistry` implementations:
- `RealThemeRegistry` — this was previously the `ThemeRegistry` and
contains the real implementation of the registry.
- `VoidThemeRegistry` — a null object that doesn't have any behavior.
Release Notes:
- N/A
This PR adds a theme preview tab to help get an at a glance overview of
the styles in a theme.
![CleanShot 2024-10-31 at 11 27
18@2x](https://github.com/user-attachments/assets/798e97cf-9f80-4994-b2fd-ac1dcd58e4d9)
You can open it using `debug: open theme preview`.
The next major theme preview PR will move this into it's own crate, as
it will grow substantially as we add content.
Next for theme preview:
- Update layout to two columns, with controls on the right for selecting
theme, layer/elevation-index, etc.
- Cover more UI elements in preview
- Display theme colors in a more helpful way
- Add syntax & markdown previews
Release Notes:
- Added a way to preview the current theme's styles with the `debug:
open theme preview` command.
This PR changes the way we load user themes into the ThemeRegistry.
Rather than directly pass a theme family's themes to
`insert_user_themes`, instead we use the new `refine_theme_family ` and
`ThemeFamily::refine_theme`.
This PR should have net zero change to themes today, but sets up
enabling theme variables. We need to do it this way so each theme has
access to it's family when it is refined.
Release Notes:
- N/A
See #12673https://github.com/user-attachments/assets/94079afc-a851-4206-9c9b-4fad3542334e
TODO:
- [x] Make active indent guides work for autofolded directories
- [x] Figure out which theme colors to use
- [x] Fix horizontal scrolling
- [x] Make indent guides easier to click
- [x] Fix selected background flashing when hovering over entry/indent
guide
- [x] Docs
Release Notes:
- Added indent guides to the project panel
Supersedes https://github.com/zed-industries/zed/pull/19166
TODO:
- [x] Update basic zed paths
- [x] update create_state_directory
- [x] Use this with `NodeRuntime`
- [x] Add server settings
- [x] Add an 'open server settings command'
- [x] Make sure it all works
Release Notes:
- Updated the actions `zed::OpenLocalSettings` and `zed::OpenLocalTasks`
to `zed::OpenProjectSettings` and `zed::OpenProjectTasks`.
---------
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Richard <richard@zed.dev>
This PR does some spring cleaning on the `theme` crate:
- Removed two unused stories and the story dep
- Removed the `one` theme family (from the `theme` crate, not the app),
this is now `zed_default_themes`.
- This will hopefully remove some confusion caused by this theme we
started in rust but didn't end up using
- Removed `theme::prelude` (it just re-exported scale colors, which we
don't use outside `theme`)
- Removed completely unused `zed_pro` themes (we started on these during
the gpui2 port and didn't finish them.)
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR enables required documentation for the `theme` crate starts on
documenting it.
The end goal is to have all meaningful documentation in the crate filled
out – However I'm not sure that just adding `#![deny(missing_docs)]` to
the whole crate is the right approach.
I don't know that having 200+ "The color of the _ color" field docs is
useful however–In the short term I've excluded some of the modules that
contain structs with a ton of fields (`colors, `status`, etc.) until we
decide what the right solution here is.
Next steps are to clean up the crate, removing unused modules or those
with low usage in favor of other approaches.
Changes in this PR:
- Enable the `deny(missing_docs)` lint for the `theme` crate
- Start documenting a subset of the crate.
- Enable `#![allow(missing_docs)]` for some modules.
Release Notes:
- N/A
Closes#18531
This PR limits the range of values that can be set for `FontWeight`.
Since any value less than 1.0 or greater than 999.9 causes Zed to crash
on Windows, I’ve restricted `FontWeight` to this range.
I could apply this constraint only on Windows, but considering the
documentation at https://zed.dev/docs/configuring-zed#buffer-font-weight
indicates that `FontWeight` should be between 100 and 900, I thought it
might be a good idea to apply this restriction in the settings.
Release Notes:
- Changed `ui_font_weight` and `buffer_font_weight` settings to require
values to be between `100` and `950` (inclusive).
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Closes https://github.com/zed-industries/zed/issues/16380
Currently brackets are highlighted with
`editor.document_highlight.read_background`. This commit adds a separate
`editor.document_highlight.bracket_background` theme setting so bracket
highlights can be made more prominent without doing the same to other
highlights, making the display too busy.
(My own theme)
https://github.com/user-attachments/assets/29a8c05e-2f1a-4c16-9be8-a4b4cb143548
I set defaults for light and dark theme that I hope are sensible and not
too obnoxious, but noticeable so people can change it if they don't like
it.
Release Notes:
- Added `editor.document_highlight.bracket_background` field to the
theme to set background color of highlighted brackets.
- This will fall back to `editor.document_highlight.read_background`, if
not set.
<img width="355" alt="Screenshot 2024-09-08 at 8 46 57 AM"
src="https://github.com/user-attachments/assets/3270bb4d-19f5-4b34-8003-982377b2ceb6">
<img width="444" alt="Screenshot 2024-09-08 at 9 03 27 AM"
src="https://github.com/user-attachments/assets/3b12d84d-913c-4bde-9132-9b10f4a8d49b">
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Appologies if this PR is off base, I'm still not super familiar with the
Zed codebase.
I was trying to integrate with
https://github.com/zed-industries/zed/pull/12940
and found it awkward to hook up global bindings to adjust the UI font
size due to the fact it takes a WindowContext. Looking at the API, it
seemed odd that it took a WindowContext, yet the editor font methods
take an AppContext.
I couldn't find a compelling reason for this to be tied to a
WindowContext, so I personally think it makes sense to switch it.
This does have a behavior change, which hopefully is actually desirable:
Currently, if you have two open and visible Zed windows, and trigger a
UI font adjustment in one, the non-active windows won't update. However,
once you switch focus to the second one it will snap to the new UI font
size. This is inconsistent with adjusting the editor font size, which
applies to all open windows immediately.
Release Notes:
- N/A
This PR clamps the `ui_font_size` and `buffer_font_size` settings
between 6px and 100px.
Release Notes:
- Changed `ui_font_size` and `buffer_font_size` to require values to be
between 6px and 100px (inclusive).
This PR follows up #16466, changes the default value used when
autocompleting the `ui_font_fallbacks` and `ui_font_fallbacks` settings
from `null` to `[]`.
Special thanks to @maxdeviant for the guidance on writing better code!
Release Notes:
- N/A
This PR allows configuring the intensity of code fade applied to unused
code (relates to #4785).
_Note: Right now I included it as a top level config which might be a
little out of place (but is easiest to instrument). Open for suggestions
on where else it would be better suited for._
_Note 2: I am unfamiliar with the codebase. Feel free to either close
this PR and re-implement in a better way or suggest high level changes
if I'm approaching anything wrong :)._
Release Notes:
- Added `unnecesary_code_fade` setting to control how strongly to fade
unused code.
---------
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR changes the default value used when autocompleting the
`ui_font_features` and `ui_font_features` settings from `null` to `{}`.
Release Notes:
- N/A
This PR changes the fallback color for the
`title_bar.inactive_background` theme property so that the title bar
doesn't just disappear when a theme doesn't have a value set.
You're welcome, @naomieow.
Release Notes:
- linux: Changed the fallback color of `title_bar.inactive_background`
to a non-transparent value.
This PR extends the fix from #15336 to more places that had the same
issue.
An `add_references_to_properties` helper function has been added to
handle these cases uniformly.
Release Notes:
- N/A
This PR fixes an issue where we would clobber the other JSON Schema
fields for any field that we attached a reference to.
This resulted in these fields (e.g., `buffer_font_family`,
`ui_font_family`) losing things like their descriptions.
The approach has been adjusted that references are now added in an
additive fashion, rather than overriding the entire schema object.
Release Notes:
- Fixed an issue where font-related settings in `settings.json` were
missing their descriptions.
Supersedes https://github.com/zed-industries/zed/pull/12090fixes#5180fixes#5055
See original PR for an example of the feature at work.
This PR changes the settings interface to be backwards compatible, and
adds the `ui_font_fallbacks`, `buffer_font_fallbacks`, and
`terminal.font_fallbacks` settings.
Release Notes:
- Added support for font fallbacks via three new settings:
`ui_font_fallbacks`, `buffer_font_fallbacks`, and
`terminal.font_fallbacks`.(#5180, #5055).
---------
Co-authored-by: Junkui Zhang <364772080@qq.com>
This PR adds a `NumericStepper` component that can be used to display a
numeric value along with controls to increment, decrement, and reset the
value.
The `ApplicationMenu` has been updated to use the `NumericStepper` for
adjusting the buffer and UI font size.
Here it is in action:
https://github.com/zed-industries/zed/assets/1486634/03cffe67-1256-4283-aa3d-560fffa06dad
Note: Due to the way we do font adjustments, once modified the reset
button will be displayed until it is clicked (or the font size
adjustment is otherwise reset). Simply returning to the original value
will currently not hide the reset button.
Release Notes:
- N/A
This PR adds support for full client side decorations on X11 and Wayland
TODO:
- [x] Adjust GPUI APIs to expose CSD related information
- [x] Implement remaining CSD features (Resizing, window border, window
shadow)
- [x] Integrate with existing background appearance and window
transparency
- [x] Figure out how to check if the window is tiled on X11
- [x] Implement in Zed
- [x] Repeatedly maximizing and unmaximizing can panic
- [x] Resizing is strangely slow
- [x] X11 resizing and movement doesn't work for this:
https://discord.com/channels/869392257814519848/1204679850208657418/1256816908519604305
- [x] The top corner can clip with current styling
- [x] Pressing titlebar buttons doesn't work
- [x] Not showing maximize / unmaximize buttons
- [x] Noisy transparency logs / surface transparency problem
https://github.com/zed-industries/zed/pull/13611#issuecomment-2201685030
- [x] Strange offsets when dragging the project panel
https://github.com/zed-industries/zed/pull/13611#pullrequestreview-2154606261
- [x] Shadow inset with `_GTK_FRAME_EXTENTS` doesn't respect tiling on
X11 (observe by snapping an X11 window in any direction)
Release Notes:
- N/A
---------
Co-authored-by: conrad <conrad@zed.dev>
Co-authored-by: Owen Law <81528246+someone13574@users.noreply.github.com>
Co-authored-by: apricotbucket28 <71973804+apricotbucket28@users.noreply.github.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
### TODO
- [x] Make sure keybinding shows up in pane + menu
- [x] Selection tool in the editor toolbar
- [x] Application Menu
- [x] Add more options to pane + menu
- Go to File...
- Go to Symbol in Project...
- [x] Add go items to the selection tool in the editor:
- Go to Symbol in Editor...
- Go to Line/Column...
- Next Problem
- Previous Problem
- [x] Fix a bug where modals opened from a context menu aren't focused
correclty
- [x] Determine if or what needs to be done with project actions:
- Difficulty is that these are exposed in the UI via clicking the
project name in the titlebar or by right clicking the root entry in the
project panel. But they require reading and are two clicks away. Is that
sufficient?
- Add Folder to Project
- Open a new project
- Open recent
- [x] Get a style pass
- [x] Implement style pass
- [x] Fix the wrong actions in the selection menu
- [x] Show selection tool toggle in the 'editor settings' thing
- [x] Put preferences section from the app menu onto the right hand user
menu
- [x] Add Project menu into app menu to replace 'preferences' section,
and put the rest of the actions there
- [ ] ~~Adopt `...` convention for opening a surface~~ uncertain what
this convention is.
- [x] Adopt link styling for webview actions
- [x] Set lucide hamburger for menu icon
- [x] Gate application menu to only show on Linux and Windows
Release Notes:
- Added a 'selection and movement' tool to the Editor's toolbar, as well
as controls to toggle it and a setting to remove it (`"toolbar":
{"selections_menu": true/false }`)
- Changed the behavior of the `+` menu in the tab bar to use standard
actions and keybindings. Replaced 'New Center Terminal' with 'New
Terminal', and 'New Search', with the usual 'Deploy Search'. Also added
item-creating actions to this menu.
- Added an 'application' menu to the titlebar to Linux and Windows
builds of Zed
This PR adds a warning when the deprecated `scrollbar_thumb.background`
style property is present in a theme.
This property has been succeeded by `scrollbar.thumb.background`.
The primary reason for this is to get it into the `zed-extension` CLI so
that we can use it to detect which themes need to be updated.
Release Notes:
- N/A
This PR removes the `color` crate, as it was not used anywhere.
We had added this experimentally, but right now its existence is just a
source of confusion.
Release Notes:
- N/A
When running the tests for linux, I found a lot of benign errors getting
logged. This PR cuts down some of the noise from unnecessary workspace
serialization and SVG renders
Release Notes:
- N/A
Release Notes:
- Added support for `background_color` in `syntax` map in `theme.json`.
This adds support for setting a `background_color` for styles inside the
`syntax` map for themes defined in `theme.json`. The field is optional
so there should be no backwards compatibility issues.
It is worth noting that the current behaviour for selecting text is that
the background colours will mix/blend (I'm not sure the correct term
here). Changing this behaviour, or making it configurable, looks to be a
far more complex issue and I'm not sure I know how to do it.
Builds on top of existing work from #2249, but here's a showcase:
https://github.com/zed-industries/zed/assets/53836821/4b346965-6654-496c-b379-75425d9b493f
TODO:
- [x] handle line wrapping
- [x] implement handling in multibuffer (crashes currently)
- [x] add configuration option
- [x] new theme properties? What colors to use?
- [x] Possibly support indents with different colors or background
colors
- [x] investigate edge cases (e.g. indent guides and folds continue on
empty lines even if the next indent is different)
- [x] add more tests (also test `find_active_indent_index`)
- [x] docs (will do in a follow up PR)
- [x] benchmark performance impact
Release Notes:
- Added indent guides
([#5373](https://github.com/zed-industries/zed/issues/5373))
---------
Co-authored-by: Nate Butler <1714999+iamnbutler@users.noreply.github.com>
Co-authored-by: Remco <djsmits12@gmail.com>
This PR removes the default syntax colors from the theme.
With the changes in #11911 these colors could leak through if the theme
didn't provide a value for that syntax color.
Removing them gives themes a clean slate to work with.
Release Notes:
- N/A
This PR improves the merging behavior for the `SyntaxTheme` such that
user-provided values get merged into the base theme.
This makes it possible to override individual styles without clobbering
the unspecified styles in the base theme.
Release Notes:
- Improved merging of `syntax` styles in the theme.
This PR addresses a TODO comment by making `SyntaxTheme::new_test` only
available in tests.
We needed to make it available when the `test-support` feature was
enabled for it to be used in tests outside of the `theme` crate.
Release Notes:
- N/A
This PR adjusts the names of the negated style methods by moving the
`neg_` to after the property name instead of before.
This will help keep related style methods grouped together in
completions.
It also makes it a bit clearer that the negation applies to the value.
### Before
```rs
div()
.neg_mx_1()
.neg_mt_2()
```
### After
```rs
div()
.mx_neg_1()
.mt_neg_2()
```
Release Notes:
- N/A
Notable things I've had to fix due to 1.78:
- Better detection of unused items
- New clippy lint (`assigning_clones`) that points out places where assignment operations with clone rhs could be replaced with more performant `clone_into`
Release Notes:
- N/A
Note: You shouldn't use the `unstable.ui_density` setting – it is only
being added for testing and to enable new UI components to be built with
density in mind. Don't expect this to work well, or at all right now.
Adds some of the basic wiring we'll need to start scaling UI elements
throughout the app based on a desired density setting.
Release Notes:
- N/A