summaryrefslogtreecommitdiff
path: root/support/texlab/src/features/cursor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/src/features/cursor.rs')
-rw-r--r--support/texlab/src/features/cursor.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/support/texlab/src/features/cursor.rs b/support/texlab/src/features/cursor.rs
index 6e8719987a..d8db0f2aa8 100644
--- a/support/texlab/src/features/cursor.rs
+++ b/support/texlab/src/features/cursor.rs
@@ -264,8 +264,21 @@ impl<P: HasPosition> CursorContext<P> {
let group = latex::CurlyGroupWordList::cast(group)
.filter(|group| self.is_inside_latex_curly(group))?;
- key.map(|key| (key.to_string(), key.small_range(), group))
- .or_else(|| Some((String::new(), TextRange::empty(self.offset), group)))
+ key.map(|key| {
+ let range = if group
+ .syntax()
+ .last_token()
+ .filter(|tok| tok.kind() == latex::MISSING)
+ .is_some()
+ {
+ TextRange::new(key.small_range().start(), token.text_range().end())
+ } else {
+ key.small_range()
+ };
+
+ (key.to_string(), range, group)
+ })
+ .or_else(|| Some((String::new(), TextRange::empty(self.offset), group)))
}
}