Add support for highlight properties that track local variables

This commit is contained in:
Max Brunsfeld 2019-05-09 12:02:18 -07:00
parent d78ac581f3
commit a7d02e7276
4 changed files with 117 additions and 5 deletions

View file

@ -138,7 +138,8 @@ impl Default for Theme {
"tag": 18,
"type": 23,
"type.builtin": {"color": 23, "bold": true},
"variable.builtin": {"bold": true}
"variable.builtin": {"bold": true},
"variable.parameter": {"underline": true}
}
"#,
)

View file

@ -16,6 +16,7 @@ use tree_sitter::{self, PropertyStateJSON, PropertyTransitionJSON};
#[serde(untagged)]
enum PropertyValue {
Number(isize),
Boolean(bool),
String(String),
Object(PropertySet),
Array(Vec<PropertyValue>),
@ -737,8 +738,8 @@ fn parse_sass_value(value: &Value) -> Result<PropertyValue> {
}
Value::Color(_, Some(name)) => Ok(PropertyValue::String(name.clone())),
Value::Numeric(n, _) => Ok(PropertyValue::Number(n.to_integer())),
Value::True => Ok(PropertyValue::String("true".to_string())),
Value::False => Ok(PropertyValue::String("false".to_string())),
Value::True => Ok(PropertyValue::Boolean(true)),
Value::False => Ok(PropertyValue::Boolean(false)),
_ => Err(Error(format!(
"Property values must be strings or function calls. Got {:?}",
value