We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1aa9c47 commit 3b14843Copy full SHA for 3b14843
crates/emmylua_code_analysis/src/vfs/document.rs
@@ -137,8 +137,19 @@ impl<'a> LuaDocument<'a> {
137
}
138
139
pub fn get_range_span(&self, range: lsp_types::Range) -> Option<(usize, usize)> {
140
+ let text = self.get_text();
141
let start = self.get_offset(range.start.line as usize, range.start.character as usize)?;
142
let end = self.get_offset(range.end.line as usize, range.end.character as usize)?;
143
+ // char count
144
+ let start = text
145
+ .get(..start.into())
146
+ .map(|s| s.chars().count())
147
+ .unwrap_or(0);
148
+ let end = text
149
+ .get(..end.into())
150
151
152
+
153
Some((start.into(), end.into()))
154
155
0 commit comments