Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
remove highlights fn from ra
Browse files Browse the repository at this point in the history
  • Loading branch information
achimcc authored and achimcc committed Jul 8, 2022
1 parent 730bc96 commit cea140a
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions crates/rust_analyzer_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,43 +300,6 @@ impl WorldState {
serde_wasm_bindgen::to_value(&res).unwrap()
}

pub fn highlights(
&self,
line_number: u32,
column: u32,
include_declaration: bool,
) -> JsValue {
log::warn!("references");
let line_index = self.analysis().file_line_index(self.file_id).unwrap();
let pos = file_position(line_number, column, &line_index, self.file_id);
let search_scope = Some(SearchScope::single_file(self.file_id));
let info = match self.analysis().find_all_refs(pos, search_scope).unwrap() {
Some(info) => info,
_ => return JsValue::NULL,
};
let mut res = vec![];
for result in info {
if include_declaration {
if let Some(r) = result.declaration {
let r = r.nav.focus_range.unwrap_or_else(|| r.nav.full_range);
res.push(Highlight {
tag: None,
range: to_proto::text_range(r, &line_index),
});
}
}
result.references.iter().for_each(|(_id, ranges)| {
for (r, _) in ranges {
res.push(Highlight {
tag: None,
range: to_proto::text_range(*r, &line_index),
});
}
});
}
serde_wasm_bindgen::to_value(&res).unwrap()
}

pub fn prepare_rename(&self, line_number: u32, column: u32) -> JsValue {
log::warn!("prepare_rename");
let line_index = self.analysis().file_line_index(self.file_id).unwrap();
Expand Down

0 comments on commit cea140a

Please sign in to comment.