Skip to content

Commit 09d1ae3

Browse files
committed
[FIX] server: scope symbol range of first expression of function and class body
1 parent 28fd961 commit 09d1ae3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/src/core/symbols/symbol.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ impl Symbol {
18161816
true => symbol.borrow().range().start().to_u32(),
18171817
false => symbol.borrow().body_range().start().to_u32(),
18181818
};
1819-
if range < offset && symbol.borrow().body_range().end().to_u32() > offset {
1819+
if range <= offset && symbol.borrow().body_range().end().to_u32() > offset {
18201820
result = Symbol::get_scope_symbol(symbol.clone(), offset, is_param);
18211821
}
18221822
},
@@ -1825,7 +1825,7 @@ impl Symbol {
18251825
true => symbol.borrow().range().start().to_u32(),
18261826
false => symbol.borrow().body_range().start().to_u32(),
18271827
};
1828-
if range < offset && symbol.borrow().body_range().end().to_u32() > offset {
1828+
if range <= offset && symbol.borrow().body_range().end().to_u32() > offset {
18291829
result = Symbol::get_scope_symbol(symbol.clone(), offset, is_param);
18301830
}
18311831
}

server/src/core/symbols/symbol_mgr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ macro_rules! impl_section_mgr_for {
6666
fn get_section_for(&self, position: u32) -> SectionRange {
6767
let mut last_section = self.sections.last().unwrap();
6868
for section in self.sections.iter().rev().skip(1) { //reverse to fasten most calls as they will be with TextSize::MAX
69-
if section.start < position {
69+
if section.start <= position {
7070
break;
7171
}
7272
last_section = section;

0 commit comments

Comments
 (0)