dev: refactor def and use cache for improving definition (#179)

* chore: add a notes to do.

* dev: cache def and use information

* dev: move signature cache to analysis level

* dev: refactor a bit for improving definition

* dev: more appropriate definition discover

* fix: clippy error
This commit is contained in:
Myriad-Dreamin 2024-04-11 20:45:02 +08:00 committed by GitHub
parent ebed95cbcd
commit c22f70b49e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 1109 additions and 667 deletions

View file

@ -2,7 +2,7 @@ use log::debug;
use lsp_types::TextEdit;
use crate::{
find_definition, find_references, prelude::*, syntax::get_deref_target,
analysis::find_definition, find_references, prelude::*, syntax::get_deref_target,
validate_renaming_definition, SemanticRequest,
};
@ -44,10 +44,12 @@ impl SemanticRequest for RenameRequest {
let mut editions = HashMap::new();
let def_loc = {
let def_source = ctx.source_by_id(lnk.fid).ok()?;
let (fid, _def_range) = lnk.def_at?;
let span_path = ctx.path_for_id(lnk.fid).ok()?;
let def_loc = {
let def_source = ctx.source_by_id(fid).ok()?;
let span_path = ctx.path_for_id(fid).ok()?;
let uri = path_to_url(&span_path).ok()?;
let Some(range) = lnk.name_range else {