More lua hints

This commit is contained in:
ef3d0c3e 2024-10-27 09:40:12 +01:00
parent 141760a677
commit f23f8db994
2 changed files with 16 additions and 7 deletions

View file

@ -269,13 +269,13 @@ pub mod tests {
);
validate_semantics!(state, source.clone(), 0,
elemstyle_operator { delta_line == 1, delta_start == 0, length == 2 };
elemstyle_name { delta_line == 0, delta_start == 2, length == 14 };
elemstyle_equal { delta_line == 0, delta_start == 14, length == 1 };
elemstyle_value { delta_line == 0, delta_start == 2, length == 2 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 23 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 31 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 2 };
elemstyle_operator { delta_line == 1, delta_start == 0, length == 2 };
elemstyle_name { delta_line == 0, delta_start == 2, length == 14 };
elemstyle_equal { delta_line == 0, delta_start == 14, length == 1 };
elemstyle_value { delta_line == 0, delta_start == 2, length == 2 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 23 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 31 };
elemstyle_value { delta_line == 1, delta_start == 0, length == 2 };
);
}
}

View file

@ -212,15 +212,24 @@ impl RegexRule for ScriptRule {
)),
);
}
if let Some(hints) = Hints::from_source(token.source(), &state.shared.lsp) {
hints.add(matches.get(0).unwrap().end(), result);
}
} else if kind == 2
// Eval and Parse
{
if let Some(hints) = Hints::from_source(token.source(), &state.shared.lsp) {
hints.add(matches.get(0).unwrap().end(), result.clone());
}
let parse_source = Rc::new(VirtualSource::new(
Token::new(0..source.content().len(), source.clone()),
format!(":LUA:parse({})", source.name()),
result,
)) as Rc<dyn Source>;
state.with_state(|new_state| {
new_state.parser.parse_into(
new_state,