mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 04:44:30 +00:00
Hack to fix syntax.constructor
causing TS error
This commit is contained in:
parent
75a9cfdabe
commit
ad4201f768
2 changed files with 6 additions and 1 deletions
|
@ -56,7 +56,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,6 +121,7 @@ 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<Syntax>
|
||||
|
||||
const defaultSyntaxHighlightStyle: Omit<SyntaxHighlightStyle, "color"> = {
|
||||
|
|
|
@ -41,6 +41,8 @@ const ramps = {
|
|||
magenta: colorRamp(chroma("#be5046")),
|
||||
}
|
||||
|
||||
|
||||
|
||||
const syntax: ThemeSyntax = {
|
||||
boolean: { color: color.orange },
|
||||
comment: { color: color.grey },
|
||||
|
@ -63,6 +65,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