mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Merge pull request #2239 from zed-industries/add-constructor-to-syntax-overrides
Add constructor to syntax overrides
This commit is contained in:
commit
246a6adab7
3 changed files with 14 additions and 9 deletions
|
@ -32,7 +32,13 @@ export default function feedback(colorScheme: ColorScheme) {
|
|||
},
|
||||
button_margin: 8,
|
||||
info_text_default: text(layer, "sans", "default", { size: "xs" }),
|
||||
link_text_default: text(layer, "sans", "default", { size: "xs", underline: true }),
|
||||
link_text_hover: text(layer, "sans", "hovered", { size: "xs", underline: true })
|
||||
link_text_default: text(layer, "sans", "default", {
|
||||
size: "xs",
|
||||
underline: true,
|
||||
}),
|
||||
link_text_hover: text(layer, "sans", "hovered", {
|
||||
size: "xs",
|
||||
underline: true,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import deepmerge from "deepmerge"
|
||||
import { FontWeight, fontWeights } from "../../common"
|
||||
import {
|
||||
ColorScheme,
|
||||
} from "./colorScheme"
|
||||
import { ColorScheme } from "./colorScheme"
|
||||
|
||||
export interface SyntaxHighlightStyle {
|
||||
color: string
|
||||
|
@ -56,7 +54,8 @@ export interface Syntax {
|
|||
"string.regex": SyntaxHighlightStyle
|
||||
|
||||
// == Types ====== /
|
||||
constructor: SyntaxHighlightStyle
|
||||
// We allow Function here because all JS objects literals have this property
|
||||
constructor: SyntaxHighlightStyle | Function
|
||||
variant: SyntaxHighlightStyle
|
||||
type: SyntaxHighlightStyle
|
||||
// js: predefined_type
|
||||
|
@ -120,7 +119,8 @@ export interface Syntax {
|
|||
|
||||
// HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it.
|
||||
// For now hack around it by omiting constructor as a valid key for overrides.
|
||||
export type ThemeSyntax = Partial<Omit<Syntax, "constructor">>
|
||||
// export type ThemeSyntax = Partial<Omit<Syntax, "constructor">>
|
||||
export type ThemeSyntax = Partial<Syntax>
|
||||
|
||||
const defaultSyntaxHighlightStyle: Omit<SyntaxHighlightStyle, "color"> = {
|
||||
weight: fontWeights.normal,
|
||||
|
@ -312,8 +312,6 @@ function buildDefaultSyntax(colorScheme: ColorScheme): Syntax {
|
|||
},
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(defaultSyntax, null, 2))
|
||||
|
||||
return defaultSyntax
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ const syntax: ThemeSyntax = {
|
|||
type: { color: color.teal },
|
||||
"variable.special": { color: color.orange },
|
||||
variant: { color: color.blue },
|
||||
constructor: { color: color.blue },
|
||||
}
|
||||
|
||||
export const dark = createColorScheme(name, false, ramps, syntax)
|
||||
|
|
Loading…
Reference in a new issue