Pull editor inlay hints from VS Code themes

This commit is contained in:
Marshall Bowers 2023-12-07 15:36:13 -05:00
parent 6a164db700
commit fa223e0c6f
14 changed files with 61 additions and 1 deletions

View file

@ -283,11 +283,14 @@ impl<'a> Debug for StatusColorsRefinementPrinter<'a> {
("deleted", self.0.deleted),
("error", self.0.error),
("hidden", self.0.hidden),
("hint", self.0.hint),
("ignored", self.0.ignored),
("info", self.0.info),
("modified", self.0.modified),
("predictive", self.0.predictive),
("renamed", self.0.renamed),
("success", self.0.success),
("unreachable", self.0.unreachable),
("warning", self.0.warning),
];

View file

@ -1,5 +1,5 @@
use anyhow::Result;
use gpui::{Hsla, Rgba};
use gpui::{rgba, Hsla, Rgba};
use indexmap::IndexMap;
use strum::IntoEnumIterator;
use theme::{
@ -66,6 +66,11 @@ impl VsCodeThemeConverter {
fn convert_status_colors(&self) -> Result<StatusColorsRefinement> {
let vscode_colors = &self.theme.colors;
let vscode_base_status_colors = StatusColorsRefinement {
hint: Some(rgba(0x969696ff).into()),
..Default::default()
};
Ok(StatusColorsRefinement {
// conflict: None,
// created: None,
@ -81,6 +86,11 @@ impl VsCodeThemeConverter {
.tab_inactive_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
hint: vscode_colors
.editor_inlay_hint_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_base_status_colors.hint),
// ignored: None,
// info: None,
// modified: None,

View file

@ -163,6 +163,18 @@ pub struct VsCodeColors {
pub editor_foreground: Option<String>,
#[serde(rename = "editor.background")]
pub editor_background: Option<String>,
#[serde(rename = "editorInlayHint.foreground")]
pub editor_inlay_hint_foreground: Option<String>,
#[serde(rename = "editorInlayHint.background")]
pub editor_inlay_hint_background: Option<String>,
#[serde(rename = "editorInlayHint.parameterForeground")]
pub editor_inlay_hint_parameter_foreground: Option<String>,
#[serde(rename = "editorInlayHint.parameterBackground")]
pub editor_inlay_hint_parameter_background: Option<String>,
#[serde(rename = "editorInlayHint.typForeground")]
pub editor_inlay_hint_typ_foreground: Option<String>,
#[serde(rename = "editorInlayHint.typBackground")]
pub editor_inlay_hint_typ_background: Option<String>,
#[serde(rename = "editorLineNumber.foreground")]
pub editor_line_number_foreground: Option<String>,
#[serde(rename = "editor.selectionBackground")]