Misc code cleanups accumulated while working on other changes (#34787)
Release Notes: - N/A
This commit is contained in:
parent
7c1040bc93
commit
137081f050
7 changed files with 9 additions and 21 deletions
|
@ -242,7 +242,7 @@ impl CommandPaletteDelegate {
|
|||
self.selected_ix = cmp::min(self.selected_ix, self.matches.len() - 1);
|
||||
}
|
||||
}
|
||||
///
|
||||
|
||||
/// Hit count for each command in the palette.
|
||||
/// We only account for commands triggered directly via command palette and not by e.g. keystrokes because
|
||||
/// if a user already knows a keystroke for a command, they are unlikely to use a command palette to look for it.
|
||||
|
|
|
@ -46,6 +46,7 @@ impl DapRegistry {
|
|||
let name = adapter.name();
|
||||
let _previous_value = self.0.write().adapters.insert(name, adapter);
|
||||
}
|
||||
|
||||
pub fn add_locator(&self, locator: Arc<dyn DapLocator>) {
|
||||
self.0.write().locators.insert(locator.name(), locator);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ fn main() {
|
|||
});
|
||||
}
|
||||
|
||||
// Associate actions using the `actions!` macro (or `impl_actions!` macro)
|
||||
// Associate actions using the `actions!` macro (or `Action` derive macro)
|
||||
actions!(set_menus, [Quit]);
|
||||
|
||||
// Define the quit function that is registered with the App
|
||||
|
|
|
@ -1370,7 +1370,9 @@ impl App {
|
|||
self.keymap.clone()
|
||||
}
|
||||
|
||||
/// Register a global listener for actions invoked via the keyboard.
|
||||
/// Register a global handler for actions invoked via the keyboard. These handlers are run at
|
||||
/// the end of the bubble phase for actions, and so will only be invoked if there are no other
|
||||
/// handlers or if they called `cx.propagate()`.
|
||||
pub fn on_action<A: Action>(&mut self, listener: impl Fn(&A, &mut Self) + 'static) {
|
||||
self.global_action_listeners
|
||||
.entry(TypeId::of::<A>())
|
||||
|
|
|
@ -25,7 +25,7 @@ fn replace_string_action(
|
|||
None
|
||||
}
|
||||
|
||||
/// "ctrl-k ctrl-1": "inline_completion::ToggleMenu" -> "edit_prediction::ToggleMenu"
|
||||
/// "space": "outline_panel::Open" -> "outline_panel::OpenSelectedEntry"
|
||||
static STRING_REPLACE: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
|
||||
HashMap::from_iter([("outline_panel::Open", "outline_panel::OpenSelectedEntry")])
|
||||
});
|
||||
|
|
|
@ -4,11 +4,10 @@ use anyhow::Result;
|
|||
use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance};
|
||||
use indexmap::IndexMap;
|
||||
use palette::FromColor;
|
||||
use schemars::{JsonSchema, json_schema};
|
||||
use schemars::{JsonSchema, JsonSchema_repr};
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
use serde_json::Value;
|
||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::{StatusColorsRefinement, ThemeColorsRefinement};
|
||||
|
||||
|
@ -1486,7 +1485,7 @@ impl From<FontStyleContent> for FontStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq)]
|
||||
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, JsonSchema_repr, PartialEq)]
|
||||
#[repr(u16)]
|
||||
pub enum FontWeightContent {
|
||||
Thin = 100,
|
||||
|
@ -1500,19 +1499,6 @@ pub enum FontWeightContent {
|
|||
Black = 900,
|
||||
}
|
||||
|
||||
impl JsonSchema for FontWeightContent {
|
||||
fn schema_name() -> Cow<'static, str> {
|
||||
"FontWeightContent".into()
|
||||
}
|
||||
|
||||
fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
json_schema!({
|
||||
"type": "integer",
|
||||
"enum": [100, 200, 300, 400, 500, 600, 700, 800, 900]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FontWeightContent> for FontWeight {
|
||||
fn from(value: FontWeightContent) -> Self {
|
||||
match value {
|
||||
|
|
|
@ -15,7 +15,6 @@ pub fn replace_subschema<T: JsonSchema>(
|
|||
generator: &mut schemars::SchemaGenerator,
|
||||
schema: impl Fn() -> schemars::Schema,
|
||||
) -> schemars::Schema {
|
||||
// fallback on just using the schema name, which could collide.
|
||||
let schema_name = T::schema_name();
|
||||
let definitions = generator.definitions_mut();
|
||||
assert!(!definitions.contains_key(&format!("{schema_name}2")));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue