Fix variables in LSP

This commit is contained in:
ef3d0c3e 2024-11-03 10:54:27 +01:00
parent ef041fcb5f
commit 379a7c7c59
4 changed files with 9 additions and 6 deletions

View file

@ -52,7 +52,7 @@ impl Variable for BaseVariable {
fn parse<'a>(&self, state: &ParserState, _location: Token, document: &'a dyn Document<'a>) {
let source = Rc::new(VirtualSource::new(
self.location().clone(),
self.name().to_string(),
format!(":VAR:{}", self.name()),
self.to_string(),
));

View file

@ -66,9 +66,8 @@ impl Element for Toc {
}
}
if sections.is_empty()
{
return Ok("".into())
if sections.is_empty() {
return Ok("".into());
}
match compiler.target() {

View file

@ -45,7 +45,9 @@ impl<'a> Hints<'a> {
lsp: &'a Option<RefCell<LSPData>>,
original_source: Rc<dyn Source>,
) -> Option<Self> {
if source.name().starts_with(":LUA:") && source.downcast_ref::<VirtualSource>().is_some() {
if (source.name().starts_with(":LUA:") || source.name().starts_with(":VAR:"))
&& source.downcast_ref::<VirtualSource>().is_some()
{
return None;
}

View file

@ -320,7 +320,9 @@ impl<'a> Semantics<'a> {
lsp: &'a Option<RefCell<LSPData>>,
original_source: Rc<dyn Source>,
) -> Option<(Self, Ref<'a, Tokens>)> {
if source.name().starts_with(":LUA:") && source.downcast_ref::<VirtualSource>().is_some() {
if (source.name().starts_with(":LUA:") || source.name().starts_with(":VAR:"))
&& source.downcast_ref::<VirtualSource>().is_some()
{
return None;
}