chore(els): improve completion

This commit is contained in:
Shunsuke Shibayama 2023-02-17 13:39:46 +09:00
parent d1ee28db78
commit 7e9cef9c07
8 changed files with 225 additions and 190 deletions

View file

@ -38,10 +38,11 @@ impl<Checker: BuildRunnable> Server<Checker> {
.filter(|warn| warn.core.main_message.ends_with("is not used"))
.collect::<Vec<_>>();
for warn in warns {
let Some(range) = util::loc_to_range(warn.core.loc) else {
let uri = util::normalize_url(Url::from_file_path(warn.input.full_path()).unwrap());
let Some(token) = self.file_cache.get_token(&uri, util::loc_to_pos(warn.core.loc).unwrap())? else {
continue;
};
match visitor.get_min_expr(range) {
match visitor.get_min_expr(&token) {
Some(Expr::Def(def)) => {
let Some(mut range) = util::loc_to_range(def.loc()) else {
Self::send_log("range not found")?;