diff --git a/src/main.rs b/src/main.rs
index ab0f8de..a6909c3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -174,7 +174,7 @@ impl LanguageServer for Backend {
})),
completion_provider: Some(CompletionOptions {
resolve_provider: Some(true),
- trigger_characters: Some(['"', '\'', '.', '_'].iter().map(char::to_string).collect()),
+ trigger_characters: Some(['"', '\'', '.', '_', ',', ' '].iter().map(char::to_string).collect()),
all_commit_characters: None,
completion_item: None,
work_done_progress_options: Default::default(),
diff --git a/src/xml.rs b/src/xml.rs
index aac9b86..60c7254 100644
--- a/src/xml.rs
+++ b/src/xml.rs
@@ -529,23 +529,28 @@ fn gather_refs<'read>(
model_filter = Some(value.as_str().to_string());
}
}
- // or
Ok(Token::Attribute { local, value, .. })
- if matches!(tag, Some(Tag::Record | Tag::Template))
- && local == "id" && value.range().contains(&offset_at_cursor) =>
+ if matches!(tag, Some(Tag::Record | Tag::Template | Tag::Menuitem))
+ && local == "id" && value.range().contains_end(offset_at_cursor) =>
{
ref_at_cursor = Some((value.as_str(), value.range()));
ref_kind = Some(RefKind::Id);
+ arch_model = None;
+ match tag {
+ Some(Tag::Template) => {
+ model_filter = Some("ir.ui.view".to_string());
+ }
+ Some(Tag::Menuitem) => {
+ model_filter = Some("ir.ui.menu".to_string());
+ }
+ _ => {}
+ }
}
//
Ok(Token::Attribute { local, value, .. })
if matches!(tag, Some(Tag::Menuitem)) && value.range().contains_end(offset_at_cursor) =>
{
match local.as_str() {
- "id" => {
- ref_at_cursor = Some((value.as_str(), value.range()));
- ref_kind = Some(RefKind::Id);
- }
"parent" => {
ref_at_cursor = Some((value.as_str(), value.range()));
ref_kind = Some(RefKind::Ref(interner.get_or_intern_static("parent_id")));
@@ -556,6 +561,12 @@ fn gather_refs<'read>(
ref_kind = Some(RefKind::Ref(interner.get_or_intern_static("action")));
model_filter = Some("ir.ui.menu".to_string());
}
+ "groups" => {
+ ref_kind = Some(RefKind::Id);
+ arch_model = None;
+ model_filter = Some("res.groups".to_string());
+ determine_csv_xmlid_subgroup(&mut ref_at_cursor, value, offset_at_cursor);
+ }
_ => {}
}
}
@@ -569,16 +580,7 @@ fn gather_refs<'read>(
ref_at_cursor = Some((local.as_str(), local.range()));
ref_kind = Some(RefKind::PropOf(component));
}
- // catchall groups=
- Ok(Token::Attribute { local, value, .. })
- if local.as_str() == "groups" && value.range().contains_end(offset_at_cursor) =>
- {
- ref_kind = Some(RefKind::Id);
- model_filter = Some("res.groups".to_string());
- arch_model = None;
- determine_csv_xmlid_subgroup(&mut ref_at_cursor, value, offset_at_cursor);
- }
- // on-hover cases
+ // catchall cases
Ok(Token::Attribute { local, value, .. }) if value.range().contains_end(offset_at_cursor) => {
match local.as_str() {
"t-name" => {
@@ -593,6 +595,12 @@ fn gather_refs<'read>(
ref_at_cursor = Some((value.as_str(), value.range()));
ref_kind = Some(RefKind::TCall);
}
+ "groups" => {
+ ref_kind = Some(RefKind::Id);
+ model_filter = Some("res.groups".to_string());
+ arch_model = None;
+ determine_csv_xmlid_subgroup(&mut ref_at_cursor, value, offset_at_cursor);
+ }
_ => {}
}
}