mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
chore: Prefer tracing span shorthand macros
This commit is contained in:
parent
5f3de7863a
commit
27182bb96b
82 changed files with 240 additions and 275 deletions
|
@ -51,7 +51,7 @@ impl FileChange {
|
|||
}
|
||||
|
||||
pub fn apply(self, db: &mut dyn SourceDatabaseExt) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "FileChange::apply").entered();
|
||||
let _p = tracing::info_span!("FileChange::apply").entered();
|
||||
if let Some(roots) = self.roots {
|
||||
for (idx, root) in roots.into_iter().enumerate() {
|
||||
let root_id = SourceRootId(idx as u32);
|
||||
|
|
|
@ -412,7 +412,7 @@ impl CrateGraph {
|
|||
from: CrateId,
|
||||
dep: Dependency,
|
||||
) -> Result<(), CyclicDependenciesError> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "add_dep").entered();
|
||||
let _p = tracing::info_span!("add_dep").entered();
|
||||
|
||||
self.check_cycle_after_dependency(from, dep.crate_id)?;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ fn toolchain_channel(db: &dyn SourceDatabase, krate: CrateId) -> Option<ReleaseC
|
|||
}
|
||||
|
||||
fn parse(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse", ?file_id).entered();
|
||||
let _p = tracing::info_span!("parse", ?file_id).entered();
|
||||
let text = db.file_text(file_id);
|
||||
// FIXME: Edition based parsing
|
||||
SourceFile::parse(&text, span::Edition::CURRENT)
|
||||
|
@ -187,7 +187,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
|
|||
}
|
||||
|
||||
fn relevant_crates(&self, file_id: FileId) -> Arc<[CrateId]> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "relevant_crates").entered();
|
||||
let _p = tracing::info_span!("relevant_crates").entered();
|
||||
let source_root = self.0.file_source_root(file_id);
|
||||
self.0.source_root_crates(source_root)
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Attrs {
|
|||
db: &dyn DefDatabase,
|
||||
v: VariantId,
|
||||
) -> Arc<ArenaMap<LocalFieldId, Attrs>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "fields_attrs_query").entered();
|
||||
let _p = tracing::info_span!("fields_attrs_query").entered();
|
||||
// FIXME: There should be some proper form of mapping between item tree field ids and hir field ids
|
||||
let mut res = ArenaMap::default();
|
||||
|
||||
|
@ -321,7 +321,7 @@ impl AttrsWithOwner {
|
|||
}
|
||||
|
||||
pub(crate) fn attrs_query(db: &dyn DefDatabase, def: AttrDefId) -> Attrs {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "attrs_query").entered();
|
||||
let _p = tracing::info_span!("attrs_query").entered();
|
||||
// FIXME: this should use `Trace` to avoid duplication in `source_map` below
|
||||
let raw_attrs = match def {
|
||||
AttrDefId::ModuleId(module) => {
|
||||
|
|
|
@ -124,7 +124,7 @@ impl Body {
|
|||
db: &dyn DefDatabase,
|
||||
def: DefWithBodyId,
|
||||
) -> (Arc<Body>, Arc<BodySourceMap>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "body_with_source_map_query").entered();
|
||||
let _p = tracing::info_span!("body_with_source_map_query").entered();
|
||||
let mut params = None;
|
||||
|
||||
let mut is_async_fn = false;
|
||||
|
|
|
@ -340,7 +340,7 @@ impl ImplData {
|
|||
db: &dyn DefDatabase,
|
||||
id: ImplId,
|
||||
) -> (Arc<ImplData>, DefDiagnostics) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "impl_data_with_diagnostics_query").entered();
|
||||
let _p = tracing::info_span!("impl_data_with_diagnostics_query").entered();
|
||||
let ItemLoc { container: module_id, id: tree_id } = id.lookup(db);
|
||||
|
||||
let item_tree = tree_id.item_tree(db);
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn find_path(
|
|||
ignore_local_imports: bool,
|
||||
mut cfg: ImportPathConfig,
|
||||
) -> Option<ModPath> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "find_path").entered();
|
||||
let _p = tracing::info_span!("find_path").entered();
|
||||
|
||||
// - if the item is a builtin, it's in scope
|
||||
if let ItemInNs::Types(ModuleDefId::BuiltinType(builtin)) = item {
|
||||
|
@ -474,7 +474,7 @@ fn find_local_import_locations(
|
|||
def_map: &DefMap,
|
||||
mut cb: impl FnMut(&Name, ModuleId),
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "find_local_import_locations").entered();
|
||||
let _p = tracing::info_span!("find_local_import_locations").entered();
|
||||
|
||||
// `from` can import anything below `from` with visibility of at least `from`, and anything
|
||||
// above `from` with any visibility. That means we do not need to descend into private siblings
|
||||
|
|
|
@ -467,7 +467,7 @@ impl GenericParams {
|
|||
db: &dyn DefDatabase,
|
||||
def: GenericDefId,
|
||||
) -> Interned<GenericParams> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "generic_params_query").entered();
|
||||
let _p = tracing::info_span!("generic_params_query").entered();
|
||||
|
||||
let krate = def.module(db).krate;
|
||||
let cfg_options = db.crate_graph();
|
||||
|
|
|
@ -73,7 +73,7 @@ impl ImportMap {
|
|||
}
|
||||
|
||||
pub(crate) fn import_map_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<Self> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "import_map_query").entered();
|
||||
let _p = tracing::info_span!("import_map_query").entered();
|
||||
|
||||
let map = Self::collect_import_map(db, krate);
|
||||
|
||||
|
@ -124,7 +124,7 @@ impl ImportMap {
|
|||
}
|
||||
|
||||
fn collect_import_map(db: &dyn DefDatabase, krate: CrateId) -> ImportMapIndex {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "collect_import_map").entered();
|
||||
let _p = tracing::info_span!("collect_import_map").entered();
|
||||
|
||||
let def_map = db.crate_def_map(krate);
|
||||
let mut map = FxIndexMap::default();
|
||||
|
@ -214,7 +214,7 @@ impl ImportMap {
|
|||
is_type_in_ns: bool,
|
||||
trait_import_info: &ImportInfo,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "collect_trait_assoc_items").entered();
|
||||
let _p = tracing::info_span!("collect_trait_assoc_items").entered();
|
||||
for &(ref assoc_item_name, item) in &db.trait_data(tr).items {
|
||||
let module_def_id = match item {
|
||||
AssocItemId::FunctionId(f) => ModuleDefId::from(f),
|
||||
|
@ -396,7 +396,7 @@ pub fn search_dependencies(
|
|||
krate: CrateId,
|
||||
query: &Query,
|
||||
) -> FxHashSet<ItemInNs> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "search_dependencies", ?query).entered();
|
||||
let _p = tracing::info_span!("search_dependencies", ?query).entered();
|
||||
|
||||
let graph = db.crate_graph();
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ pub struct ItemTree {
|
|||
|
||||
impl ItemTree {
|
||||
pub(crate) fn file_item_tree_query(db: &dyn DefDatabase, file_id: HirFileId) -> Arc<ItemTree> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "file_item_tree_query", ?file_id).entered();
|
||||
let _p = tracing::info_span!("file_item_tree_query", ?file_id).entered();
|
||||
|
||||
let syntax = db.parse_or_expand(file_id);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ impl LangItems {
|
|||
db: &dyn DefDatabase,
|
||||
krate: CrateId,
|
||||
) -> Option<Arc<LangItems>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "crate_lang_items_query").entered();
|
||||
let _p = tracing::info_span!("crate_lang_items_query").entered();
|
||||
|
||||
let mut lang_items = LangItems::default();
|
||||
|
||||
|
@ -163,7 +163,7 @@ impl LangItems {
|
|||
start_crate: CrateId,
|
||||
item: LangItem,
|
||||
) -> Option<LangItemTarget> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "lang_item_query").entered();
|
||||
let _p = tracing::info_span!("lang_item_query").entered();
|
||||
if let Some(target) =
|
||||
db.crate_lang_items(start_crate).and_then(|it| it.items.get(&item).copied())
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ impl LangItems {
|
|||
) where
|
||||
T: Into<AttrDefId> + Copy,
|
||||
{
|
||||
let _p = tracing::span!(tracing::Level::INFO, "collect_lang_item").entered();
|
||||
let _p = tracing::info_span!("collect_lang_item").entered();
|
||||
if let Some(lang_item) = lang_attr(db, item.into()) {
|
||||
self.items.entry(lang_item).or_insert_with(|| constructor(item));
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ pub(crate) fn notable_traits_in_deps(
|
|||
db: &dyn DefDatabase,
|
||||
krate: CrateId,
|
||||
) -> Arc<[Arc<[TraitId]>]> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "notable_traits_in_deps", ?krate).entered();
|
||||
let _p = tracing::info_span!("notable_traits_in_deps", ?krate).entered();
|
||||
let crate_graph = db.crate_graph();
|
||||
|
||||
Arc::from_iter(
|
||||
|
@ -208,7 +208,7 @@ pub(crate) fn notable_traits_in_deps(
|
|||
}
|
||||
|
||||
pub(crate) fn crate_notable_traits(db: &dyn DefDatabase, krate: CrateId) -> Option<Arc<[TraitId]>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "crate_notable_traits", ?krate).entered();
|
||||
let _p = tracing::info_span!("crate_notable_traits", ?krate).entered();
|
||||
|
||||
let mut traits = Vec::new();
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ impl DefMap {
|
|||
let crate_graph = db.crate_graph();
|
||||
let krate = &crate_graph[crate_id];
|
||||
let name = krate.display_name.as_deref().unwrap_or_default();
|
||||
let _p = tracing::span!(tracing::Level::INFO, "crate_def_map_query", ?name).entered();
|
||||
let _p = tracing::info_span!("crate_def_map_query", ?name).entered();
|
||||
|
||||
let module_data = ModuleData::new(
|
||||
ModuleOrigin::CrateRoot { definition: krate.root_file_id },
|
||||
|
|
|
@ -276,7 +276,7 @@ struct DefCollector<'a> {
|
|||
|
||||
impl DefCollector<'_> {
|
||||
fn seed_with_top_level(&mut self) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "seed_with_top_level").entered();
|
||||
let _p = tracing::info_span!("seed_with_top_level").entered();
|
||||
|
||||
let crate_graph = self.db.crate_graph();
|
||||
let file_id = crate_graph[self.def_map.krate].root_file_id;
|
||||
|
@ -411,17 +411,17 @@ impl DefCollector<'_> {
|
|||
}
|
||||
|
||||
fn resolution_loop(&mut self) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "DefCollector::resolution_loop").entered();
|
||||
let _p = tracing::info_span!("DefCollector::resolution_loop").entered();
|
||||
|
||||
// main name resolution fixed-point loop.
|
||||
let mut i = 0;
|
||||
'resolve_attr: loop {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "resolve_macros loop").entered();
|
||||
let _p = tracing::info_span!("resolve_macros loop").entered();
|
||||
'resolve_macros: loop {
|
||||
self.db.unwind_if_cancelled();
|
||||
|
||||
{
|
||||
let _p = tracing::span!(tracing::Level::INFO, "resolve_imports loop").entered();
|
||||
let _p = tracing::info_span!("resolve_imports loop").entered();
|
||||
|
||||
'resolve_imports: loop {
|
||||
if self.resolve_imports() == ReachedFixedPoint::Yes {
|
||||
|
@ -447,7 +447,7 @@ impl DefCollector<'_> {
|
|||
}
|
||||
|
||||
fn collect(&mut self) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "DefCollector::collect").entered();
|
||||
let _p = tracing::info_span!("DefCollector::collect").entered();
|
||||
|
||||
self.resolution_loop();
|
||||
|
||||
|
@ -795,7 +795,7 @@ impl DefCollector<'_> {
|
|||
}
|
||||
|
||||
fn resolve_import(&self, module_id: LocalModuleId, import: &Import) -> PartialResolvedImport {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "resolve_import", import_path = %import.path.display(self.db.upcast()))
|
||||
let _p = tracing::info_span!("resolve_import", import_path = %import.path.display(self.db.upcast()))
|
||||
.entered();
|
||||
tracing::debug!("resolving import: {:?} ({:?})", import, self.def_map.data.edition);
|
||||
match import.source {
|
||||
|
@ -857,7 +857,7 @@ impl DefCollector<'_> {
|
|||
}
|
||||
|
||||
fn record_resolved_import(&mut self, directive: &ImportDirective) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "record_resolved_import").entered();
|
||||
let _p = tracing::info_span!("record_resolved_import").entered();
|
||||
|
||||
let module_id = directive.module_id;
|
||||
let import = &directive.import;
|
||||
|
@ -1422,7 +1422,7 @@ impl DefCollector<'_> {
|
|||
fn finish(mut self) -> DefMap {
|
||||
// Emit diagnostics for all remaining unexpanded macros.
|
||||
|
||||
let _p = tracing::span!(tracing::Level::INFO, "DefCollector::finish").entered();
|
||||
let _p = tracing::info_span!("DefCollector::finish").entered();
|
||||
|
||||
for directive in &self.unresolved_macros {
|
||||
match &directive.kind {
|
||||
|
|
|
@ -86,7 +86,7 @@ impl PerNs {
|
|||
}
|
||||
|
||||
pub fn filter_visibility(self, mut f: impl FnMut(Visibility) -> bool) -> PerNs {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "PerNs::filter_visibility").entered();
|
||||
let _p = tracing::info_span!("PerNs::filter_visibility").entered();
|
||||
PerNs {
|
||||
types: self.types.filter(|&(_, v, _)| f(v)),
|
||||
values: self.values.filter(|&(_, v, _)| f(v)),
|
||||
|
@ -119,7 +119,7 @@ impl PerNs {
|
|||
}
|
||||
|
||||
pub fn iter_items(self) -> impl Iterator<Item = (ItemInNs, Option<ImportOrExternCrate>)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "PerNs::iter_items").entered();
|
||||
let _p = tracing::info_span!("PerNs::iter_items").entered();
|
||||
self.types
|
||||
.map(|it| (ItemInNs::Types(it.0), it.2))
|
||||
.into_iter()
|
||||
|
|
|
@ -334,7 +334,7 @@ fn parse_macro_expansion(
|
|||
db: &dyn ExpandDatabase,
|
||||
macro_file: MacroFileId,
|
||||
) -> ExpandResult<(Parse<SyntaxNode>, Arc<ExpansionSpanMap>)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse_macro_expansion").entered();
|
||||
let _p = tracing::info_span!("parse_macro_expansion").entered();
|
||||
let loc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||
let edition = loc.def.edition;
|
||||
let expand_to = loc.expand_to();
|
||||
|
@ -588,7 +588,7 @@ fn macro_expand(
|
|||
macro_call_id: MacroCallId,
|
||||
loc: MacroCallLoc,
|
||||
) -> ExpandResult<(CowArc<tt::Subtree>, MatchedArmIndex)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "macro_expand").entered();
|
||||
let _p = tracing::info_span!("macro_expand").entered();
|
||||
|
||||
let (ExpandResult { value: (tt, matched_arm), err }, span) = match loc.def.kind {
|
||||
MacroDefKind::ProcMacro(..) => {
|
||||
|
|
|
@ -809,7 +809,7 @@ impl ExpansionInfo {
|
|||
}
|
||||
|
||||
pub fn new(db: &dyn ExpandDatabase, macro_file: MacroFileId) -> ExpansionInfo {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ExpansionInfo::new").entered();
|
||||
let _p = tracing::info_span!("ExpansionInfo::new").entered();
|
||||
let loc = db.lookup_intern_macro_call(macro_file.macro_call_id);
|
||||
|
||||
let arg_tt = loc.kind.arg(db);
|
||||
|
|
|
@ -143,7 +143,7 @@ pub(crate) fn deref_by_trait(
|
|||
table @ &mut InferenceTable { db, .. }: &mut InferenceTable<'_>,
|
||||
ty: Ty,
|
||||
) -> Option<Ty> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "deref_by_trait").entered();
|
||||
let _p = tracing::info_span!("deref_by_trait").entered();
|
||||
if table.resolve_ty_shallow(&ty).inference_var(Interner).is_some() {
|
||||
// don't try to deref unknown variables
|
||||
return None;
|
||||
|
|
|
@ -806,7 +806,7 @@ pub(crate) fn impl_datum_query(
|
|||
krate: CrateId,
|
||||
impl_id: ImplId,
|
||||
) -> Arc<ImplDatum> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "impl_datum_query").entered();
|
||||
let _p = tracing::info_span!("impl_datum_query").entered();
|
||||
debug!("impl_datum {:?}", impl_id);
|
||||
let impl_: hir_def::ImplId = from_chalk(db, impl_id);
|
||||
impl_def_datum(db, krate, impl_id, impl_)
|
||||
|
|
|
@ -43,7 +43,7 @@ mod allow {
|
|||
}
|
||||
|
||||
pub fn incorrect_case(db: &dyn HirDatabase, owner: ModuleDefId) -> Vec<IncorrectCase> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "incorrect_case").entered();
|
||||
let _p = tracing::info_span!("incorrect_case").entered();
|
||||
let mut validator = DeclValidator::new(db);
|
||||
validator.validate_item(owner);
|
||||
validator.sink
|
||||
|
|
|
@ -65,8 +65,7 @@ impl BodyValidationDiagnostic {
|
|||
owner: DefWithBodyId,
|
||||
validate_lints: bool,
|
||||
) -> Vec<BodyValidationDiagnostic> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "BodyValidationDiagnostic::collect").entered();
|
||||
let _p = tracing::info_span!("BodyValidationDiagnostic::collect").entered();
|
||||
let infer = db.infer(owner);
|
||||
let body = db.body(owner);
|
||||
let mut validator =
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub fn missing_unsafe(db: &dyn HirDatabase, def: DefWithBodyId) -> Vec<ExprId> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "missing_unsafe").entered();
|
||||
let _p = tracing::info_span!("missing_unsafe").entered();
|
||||
|
||||
let mut res = Vec::new();
|
||||
let is_unsafe = match def {
|
||||
|
|
|
@ -79,7 +79,7 @@ pub(crate) use closure::{CaptureKind, CapturedItem, CapturedItemWithoutTy};
|
|||
|
||||
/// The entry point of type inference.
|
||||
pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "infer_query").entered();
|
||||
let _p = tracing::info_span!("infer_query").entered();
|
||||
let resolver = def.resolver(db.upcast());
|
||||
let body = db.body(def);
|
||||
let mut ctx = InferenceContext::new(db, def, &body, resolver);
|
||||
|
|
|
@ -613,8 +613,7 @@ impl<'a> InferenceTable<'a> {
|
|||
}
|
||||
|
||||
pub(crate) fn resolve_obligations_as_possible(&mut self) {
|
||||
let _span =
|
||||
tracing::span!(tracing::Level::INFO, "resolve_obligations_as_possible").entered();
|
||||
let _span = tracing::info_span!("resolve_obligations_as_possible").entered();
|
||||
let mut changed = true;
|
||||
let mut obligations = mem::take(&mut self.resolve_obligations_buffer);
|
||||
while mem::take(&mut changed) {
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
|||
// FIXME: Turn this into a query, it can be quite slow
|
||||
/// Checks whether a type is visibly uninhabited from a particular module.
|
||||
pub(crate) fn is_ty_uninhabited_from(db: &dyn HirDatabase, ty: &Ty, target_mod: ModuleId) -> bool {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "is_ty_uninhabited_from", ?ty).entered();
|
||||
let _p = tracing::info_span!("is_ty_uninhabited_from", ?ty).entered();
|
||||
let mut uninhabited_from =
|
||||
UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() };
|
||||
let inhabitedness = ty.visit_with(&mut uninhabited_from, DebruijnIndex::INNERMOST);
|
||||
|
@ -30,7 +30,7 @@ pub(crate) fn is_enum_variant_uninhabited_from(
|
|||
subst: &Substitution,
|
||||
target_mod: ModuleId,
|
||||
) -> bool {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "is_enum_variant_uninhabited_from").entered();
|
||||
let _p = tracing::info_span!("is_enum_variant_uninhabited_from").entered();
|
||||
|
||||
let mut uninhabited_from =
|
||||
UninhabitedFrom { target_mod, db, max_depth: 500, recursive_ty: FxHashSet::default() };
|
||||
|
|
|
@ -144,8 +144,7 @@ pub struct TraitImpls {
|
|||
|
||||
impl TraitImpls {
|
||||
pub(crate) fn trait_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "trait_impls_in_crate_query", ?krate).entered();
|
||||
let _p = tracing::info_span!("trait_impls_in_crate_query", ?krate).entered();
|
||||
let mut impls = FxHashMap::default();
|
||||
|
||||
Self::collect_def_map(db, &mut impls, &db.crate_def_map(krate));
|
||||
|
@ -157,7 +156,7 @@ impl TraitImpls {
|
|||
db: &dyn HirDatabase,
|
||||
block: BlockId,
|
||||
) -> Option<Arc<Self>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "trait_impls_in_block_query").entered();
|
||||
let _p = tracing::info_span!("trait_impls_in_block_query").entered();
|
||||
let mut impls = FxHashMap::default();
|
||||
|
||||
Self::collect_def_map(db, &mut impls, &db.block_def_map(block));
|
||||
|
@ -173,8 +172,7 @@ impl TraitImpls {
|
|||
db: &dyn HirDatabase,
|
||||
krate: CrateId,
|
||||
) -> Arc<[Arc<Self>]> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "trait_impls_in_deps_query", ?krate).entered();
|
||||
let _p = tracing::info_span!("trait_impls_in_deps_query", ?krate).entered();
|
||||
let crate_graph = db.crate_graph();
|
||||
|
||||
Arc::from_iter(
|
||||
|
@ -280,8 +278,7 @@ pub struct InherentImpls {
|
|||
|
||||
impl InherentImpls {
|
||||
pub(crate) fn inherent_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "inherent_impls_in_crate_query", ?krate).entered();
|
||||
let _p = tracing::info_span!("inherent_impls_in_crate_query", ?krate).entered();
|
||||
let mut impls = Self { map: FxHashMap::default(), invalid_impls: Vec::default() };
|
||||
|
||||
let crate_def_map = db.crate_def_map(krate);
|
||||
|
@ -295,7 +292,7 @@ impl InherentImpls {
|
|||
db: &dyn HirDatabase,
|
||||
block: BlockId,
|
||||
) -> Option<Arc<Self>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "inherent_impls_in_block_query").entered();
|
||||
let _p = tracing::info_span!("inherent_impls_in_block_query").entered();
|
||||
let mut impls = Self { map: FxHashMap::default(), invalid_impls: Vec::default() };
|
||||
|
||||
let block_def_map = db.block_def_map(block);
|
||||
|
@ -368,7 +365,7 @@ pub(crate) fn incoherent_inherent_impl_crates(
|
|||
krate: CrateId,
|
||||
fp: TyFingerprint,
|
||||
) -> SmallVec<[CrateId; 2]> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "incoherent_inherent_impl_crates").entered();
|
||||
let _p = tracing::info_span!("incoherent_inherent_impl_crates").entered();
|
||||
let mut res = SmallVec::new();
|
||||
let crate_graph = db.crate_graph();
|
||||
|
||||
|
@ -937,8 +934,7 @@ pub fn iterate_method_candidates_dyn(
|
|||
mode: LookupMode,
|
||||
callback: &mut dyn FnMut(ReceiverAdjustments, AssocItemId, bool) -> ControlFlow<()>,
|
||||
) -> ControlFlow<()> {
|
||||
let _p = tracing::span!(
|
||||
tracing::Level::INFO,
|
||||
let _p = tracing::info_span!(
|
||||
"iterate_method_candidates_dyn",
|
||||
?mode,
|
||||
?name,
|
||||
|
@ -1504,7 +1500,7 @@ fn is_valid_impl_fn_candidate(
|
|||
}
|
||||
}
|
||||
table.run_in_snapshot(|table| {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "subst_for_def").entered();
|
||||
let _p = tracing::info_span!("subst_for_def").entered();
|
||||
let impl_subst =
|
||||
TyBuilder::subst_for_def(db, impl_id, None).fill_with_inference_vars(table).build();
|
||||
let expect_self_ty = db.impl_self_ty(impl_id).substitute(Interner, &impl_subst);
|
||||
|
@ -1512,7 +1508,7 @@ fn is_valid_impl_fn_candidate(
|
|||
check_that!(table.unify(&expect_self_ty, self_ty));
|
||||
|
||||
if let Some(receiver_ty) = receiver_ty {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "check_receiver_ty").entered();
|
||||
let _p = tracing::info_span!("check_receiver_ty").entered();
|
||||
check_that!(data.has_self_param());
|
||||
|
||||
let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst.clone()))
|
||||
|
|
|
@ -91,7 +91,7 @@ pub fn borrowck_query(
|
|||
db: &dyn HirDatabase,
|
||||
def: DefWithBodyId,
|
||||
) -> Result<Arc<[BorrowckResult]>, MirLowerError> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "borrowck_query").entered();
|
||||
let _p = tracing::info_span!("borrowck_query").entered();
|
||||
let mut res = vec![];
|
||||
all_mir_bodies(db, def, |body| {
|
||||
res.push(BorrowckResult {
|
||||
|
|
|
@ -2133,7 +2133,7 @@ pub fn mir_body_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Result<Arc<Mi
|
|||
}
|
||||
DefWithBodyId::InTypeConstId(it) => format!("in type const {it:?}"),
|
||||
};
|
||||
let _p = tracing::span!(tracing::Level::INFO, "mir_body_query", ?detail).entered();
|
||||
let _p = tracing::info_span!("mir_body_query", ?detail).entered();
|
||||
let body = db.body(def);
|
||||
let infer = db.infer(def);
|
||||
let mut result = lower_to_mir(db, def, &body, &infer, body.body_expr)?;
|
||||
|
|
|
@ -108,7 +108,7 @@ pub(crate) fn trait_solve_query(
|
|||
GoalData::DomainGoal(DomainGoal::Holds(WhereClause::AliasEq(_))) => "alias_eq".to_owned(),
|
||||
_ => "??".to_owned(),
|
||||
};
|
||||
let _p = tracing::span!(tracing::Level::INFO, "trait_solve_query", ?detail).entered();
|
||||
let _p = tracing::info_span!("trait_solve_query", ?detail).entered();
|
||||
tracing::info!("trait_solve_query({:?})", goal.value.goal);
|
||||
|
||||
if let GoalData::DomainGoal(DomainGoal::Holds(WhereClause::AliasEq(AliasEq {
|
||||
|
@ -140,7 +140,7 @@ fn solve(
|
|||
block: Option<BlockId>,
|
||||
goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<Interner>>>,
|
||||
) -> Option<chalk_solve::Solution<Interner>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "solve", ?krate, ?block).entered();
|
||||
let _p = tracing::info_span!("solve", ?krate, ?block).entered();
|
||||
let context = ChalkContext { db, krate, block };
|
||||
tracing::debug!("solve goal: {:?}", goal);
|
||||
let mut solver = create_chalk_solver();
|
||||
|
|
|
@ -243,7 +243,7 @@ impl Crate {
|
|||
db: &dyn DefDatabase,
|
||||
query: import_map::Query,
|
||||
) -> impl Iterator<Item = Either<ModuleDef, Macro>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "query_external_importables").entered();
|
||||
let _p = tracing::info_span!("query_external_importables").entered();
|
||||
import_map::search_dependencies(db, self.into(), &query).into_iter().map(|item| {
|
||||
match ItemInNs::from(item) {
|
||||
ItemInNs::Types(mod_id) | ItemInNs::Values(mod_id) => Either::Left(mod_id),
|
||||
|
@ -552,8 +552,7 @@ impl Module {
|
|||
acc: &mut Vec<AnyDiagnostic>,
|
||||
style_lints: bool,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "Module::diagnostics", name = ?self.name(db))
|
||||
.entered();
|
||||
let _p = tracing::info_span!("Module::diagnostics", name = ?self.name(db)).entered();
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
for diag in def_map.diagnostics() {
|
||||
if diag.in_module != self.id.local_id {
|
||||
|
@ -4631,8 +4630,7 @@ impl Type {
|
|||
name: Option<&Name>,
|
||||
mut callback: impl FnMut(Function) -> Option<T>,
|
||||
) -> Option<T> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "iterate_method_candidates_with_traits").entered();
|
||||
let _p = tracing::info_span!("iterate_method_candidates_with_traits").entered();
|
||||
let mut slot = None;
|
||||
|
||||
self.iterate_method_candidates_dyn(
|
||||
|
@ -4681,8 +4679,7 @@ impl Type {
|
|||
name: Option<&Name>,
|
||||
callback: &mut dyn FnMut(AssocItemId) -> ControlFlow<()>,
|
||||
) {
|
||||
let _p = tracing::span!(
|
||||
tracing::Level::INFO,
|
||||
let _p = tracing::info_span!(
|
||||
"iterate_method_candidates_dyn",
|
||||
with_local_impls = traits_in_scope.len(),
|
||||
traits_in_scope = traits_in_scope.len(),
|
||||
|
@ -4720,7 +4717,7 @@ impl Type {
|
|||
name: Option<&Name>,
|
||||
mut callback: impl FnMut(AssocItem) -> Option<T>,
|
||||
) -> Option<T> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "iterate_path_candidates").entered();
|
||||
let _p = tracing::info_span!("iterate_path_candidates").entered();
|
||||
let mut slot = None;
|
||||
self.iterate_path_candidates_dyn(
|
||||
db,
|
||||
|
@ -4787,7 +4784,7 @@ impl Type {
|
|||
&'a self,
|
||||
db: &'a dyn HirDatabase,
|
||||
) -> impl Iterator<Item = Trait> + 'a {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "applicable_inherent_traits").entered();
|
||||
let _p = tracing::info_span!("applicable_inherent_traits").entered();
|
||||
self.autoderef_(db)
|
||||
.filter_map(|ty| ty.dyn_trait())
|
||||
.flat_map(move |dyn_trait_id| hir_ty::all_super_traits(db.upcast(), dyn_trait_id))
|
||||
|
@ -4795,7 +4792,7 @@ impl Type {
|
|||
}
|
||||
|
||||
pub fn env_traits<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Trait> + 'a {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "env_traits").entered();
|
||||
let _p = tracing::info_span!("env_traits").entered();
|
||||
self.autoderef_(db)
|
||||
.filter(|ty| matches!(ty.kind(Interner), TyKind::Placeholder(_)))
|
||||
.flat_map(|ty| {
|
||||
|
|
|
@ -780,7 +780,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
mut token: SyntaxToken,
|
||||
f: &mut dyn FnMut(InFile<SyntaxToken>) -> ControlFlow<()>,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "descend_into_macros_impl").entered();
|
||||
let _p = tracing::info_span!("descend_into_macros_impl").entered();
|
||||
let (sa, span, file_id) =
|
||||
match token.parent().and_then(|parent| self.analyze_no_infer(&parent)) {
|
||||
Some(sa) => match sa.file_id.file_id() {
|
||||
|
@ -1462,7 +1462,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
offset: Option<TextSize>,
|
||||
infer_body: bool,
|
||||
) -> Option<SourceAnalyzer> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "SemanticsImpl::analyze_impl").entered();
|
||||
let _p = tracing::info_span!("SemanticsImpl::analyze_impl").entered();
|
||||
let node = self.find_file(node);
|
||||
|
||||
let container = self.with_ctx(|ctx| ctx.find_container(node))?;
|
||||
|
|
|
@ -126,7 +126,7 @@ pub(super) struct SourceToDefCtx<'db, 'cache> {
|
|||
|
||||
impl SourceToDefCtx<'_, '_> {
|
||||
pub(super) fn file_to_def(&mut self, file: FileId) -> &SmallVec<[ModuleId; 1]> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "SourceToDefCtx::file_to_def").entered();
|
||||
let _p = tracing::info_span!("SourceToDefCtx::file_to_def").entered();
|
||||
self.cache.file_to_def_cache.entry(file).or_insert_with(|| {
|
||||
let mut mods = SmallVec::new();
|
||||
for &crate_id in self.db.relevant_crates(file).iter() {
|
||||
|
@ -146,7 +146,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
}
|
||||
|
||||
pub(super) fn module_to_def(&mut self, src: InFile<&ast::Module>) -> Option<ModuleId> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "module_to_def").entered();
|
||||
let _p = tracing::info_span!("module_to_def").entered();
|
||||
let parent_declaration = self
|
||||
.ancestors_with_macros(src.syntax_ref(), |_, ancestor| {
|
||||
ancestor.map(Either::<ast::Module, ast::BlockExpr>::cast).transpose()
|
||||
|
@ -173,7 +173,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
}
|
||||
|
||||
pub(super) fn source_file_to_def(&mut self, src: InFile<&ast::SourceFile>) -> Option<ModuleId> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "source_file_to_def").entered();
|
||||
let _p = tracing::info_span!("source_file_to_def").entered();
|
||||
let file_id = src.file_id.original_file(self.db.upcast());
|
||||
self.file_to_def(file_id).first().copied()
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ impl SourceToDefCtx<'_, '_> {
|
|||
}
|
||||
|
||||
pub(super) fn find_container(&mut self, src: InFile<&SyntaxNode>) -> Option<ChildContainer> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "find_container").entered();
|
||||
let _p = tracing::info_span!("find_container").entered();
|
||||
let def =
|
||||
self.ancestors_with_macros(src, |this, container| this.container_to_def(container));
|
||||
if let Some(def) = def {
|
||||
|
@ -564,7 +564,7 @@ impl_from! {
|
|||
|
||||
impl ChildContainer {
|
||||
fn child_by_source(self, db: &dyn HirDatabase, file_id: HirFileId) -> DynMap {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ChildContainer::child_by_source").entered();
|
||||
let _p = tracing::info_span!("ChildContainer::child_by_source").entered();
|
||||
let db = db.upcast();
|
||||
match self {
|
||||
ChildContainer::DefWithBodyId(it) => it.child_by_source(db, file_id),
|
||||
|
|
|
@ -105,7 +105,7 @@ fn add_missing_impl_members_inner(
|
|||
assist_id: &'static str,
|
||||
label: &'static str,
|
||||
) -> Option<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "add_missing_impl_members_inner").entered();
|
||||
let _p = tracing::info_span!("add_missing_impl_members_inner").entered();
|
||||
let impl_def = ctx.find_node_at_offset::<ast::Impl>()?;
|
||||
let impl_ = ctx.sema.to_def(&impl_def)?;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ pub(crate) fn complete_expr_path(
|
|||
path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx,
|
||||
expr_ctx: &PathExprCtx,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "complete_expr_path").entered();
|
||||
let _p = tracing::info_span!("complete_expr_path").entered();
|
||||
if !ctx.qualifier_ctx.none() {
|
||||
return;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ pub(crate) fn complete_expr_path(
|
|||
}
|
||||
|
||||
pub(crate) fn complete_expr(acc: &mut Completions, ctx: &CompletionContext<'_>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "complete_expr").entered();
|
||||
let _p = tracing::info_span!("complete_expr").entered();
|
||||
|
||||
if !ctx.config.enable_term_search {
|
||||
return;
|
||||
|
|
|
@ -207,8 +207,7 @@ fn import_on_the_fly(
|
|||
position: SyntaxNode,
|
||||
potential_import_name: String,
|
||||
) -> Option<()> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "import_on_the_fly", ?potential_import_name).entered();
|
||||
let _p = tracing::info_span!("import_on_the_fly", ?potential_import_name).entered();
|
||||
|
||||
ImportScope::find_insert_use_container(&position, &ctx.sema)?;
|
||||
|
||||
|
@ -296,8 +295,7 @@ fn import_on_the_fly_pat_(
|
|||
position: SyntaxNode,
|
||||
potential_import_name: String,
|
||||
) -> Option<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "import_on_the_fly_pat_", ?potential_import_name)
|
||||
.entered();
|
||||
let _p = tracing::info_span!("import_on_the_fly_pat_", ?potential_import_name).entered();
|
||||
|
||||
ImportScope::find_insert_use_container(&position, &ctx.sema)?;
|
||||
|
||||
|
@ -347,9 +345,7 @@ fn import_on_the_fly_method(
|
|||
position: SyntaxNode,
|
||||
potential_import_name: String,
|
||||
) -> Option<()> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "import_on_the_fly_method", ?potential_import_name)
|
||||
.entered();
|
||||
let _p = tracing::info_span!("import_on_the_fly_method", ?potential_import_name).entered();
|
||||
|
||||
ImportScope::find_insert_use_container(&position, &ctx.sema)?;
|
||||
|
||||
|
@ -397,13 +393,8 @@ fn import_assets_for_path(
|
|||
potential_import_name: &str,
|
||||
qualifier: Option<ast::Path>,
|
||||
) -> Option<ImportAssets> {
|
||||
let _p = tracing::span!(
|
||||
tracing::Level::INFO,
|
||||
"import_assets_for_path",
|
||||
?potential_import_name,
|
||||
?qualifier
|
||||
)
|
||||
.entered();
|
||||
let _p =
|
||||
tracing::info_span!("import_assets_for_path", ?potential_import_name, ?qualifier).entered();
|
||||
|
||||
let fuzzy_name_length = potential_import_name.len();
|
||||
let mut assets_for_path = ImportAssets::for_fuzzy_path(
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(crate) fn complete_item_list(
|
|||
path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx,
|
||||
kind: &ItemListKind,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "complete_item_list").entered();
|
||||
let _p = tracing::info_span!("complete_item_list").entered();
|
||||
if path_ctx.is_trivial_path() {
|
||||
add_keywords(acc, ctx, Some(kind));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pub(crate) fn complete_mod(
|
|||
return None;
|
||||
}
|
||||
|
||||
let _p = tracing::span!(tracing::Level::INFO, "completion::complete_mod").entered();
|
||||
let _p = tracing::info_span!("completion::complete_mod").entered();
|
||||
|
||||
let mut current_module = ctx.module;
|
||||
// For `mod $0`, `ctx.module` is its parent, but for `mod f$0`, it's `mod f` itself, but we're
|
||||
|
|
|
@ -15,7 +15,7 @@ pub(crate) fn complete_type_path(
|
|||
path_ctx @ PathCompletionCtx { qualified, .. }: &PathCompletionCtx,
|
||||
location: &TypeLocation,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "complete_type_path").entered();
|
||||
let _p = tracing::info_span!("complete_type_path").entered();
|
||||
|
||||
let scope_def_applicable = |def| {
|
||||
use hir::{GenericParam::*, ModuleDef::*};
|
||||
|
|
|
@ -585,8 +585,7 @@ impl CompletionContext<'_> {
|
|||
/// A version of [`SemanticsScope::process_all_names`] that filters out `#[doc(hidden)]` items and
|
||||
/// passes all doc-aliases along, to funnel it into [`Completions::add_path_resolution`].
|
||||
pub(crate) fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef, Vec<SmolStr>)) {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "CompletionContext::process_all_names").entered();
|
||||
let _p = tracing::info_span!("CompletionContext::process_all_names").entered();
|
||||
self.scope.process_all_names(&mut |name, def| {
|
||||
if self.is_scope_def_hidden(def) {
|
||||
return;
|
||||
|
@ -597,8 +596,7 @@ impl CompletionContext<'_> {
|
|||
}
|
||||
|
||||
pub(crate) fn process_all_names_raw(&self, f: &mut dyn FnMut(Name, ScopeDef)) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::process_all_names_raw")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("CompletionContext::process_all_names_raw").entered();
|
||||
self.scope.process_all_names(f);
|
||||
}
|
||||
|
||||
|
@ -656,7 +654,7 @@ impl<'a> CompletionContext<'a> {
|
|||
position @ FilePosition { file_id, offset }: FilePosition,
|
||||
config: &'a CompletionConfig,
|
||||
) -> Option<(CompletionContext<'a>, CompletionAnalysis)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::new").entered();
|
||||
let _p = tracing::info_span!("CompletionContext::new").entered();
|
||||
let sema = Semantics::new(db);
|
||||
|
||||
let original_file = sema.parse(file_id);
|
||||
|
|
|
@ -74,7 +74,7 @@ fn expand(
|
|||
mut fake_ident_token: SyntaxToken,
|
||||
relative_offset: TextSize,
|
||||
) -> ExpansionResult {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::expand").entered();
|
||||
let _p = tracing::info_span!("CompletionContext::expand").entered();
|
||||
let mut derive_ctx = None;
|
||||
|
||||
'expansion: loop {
|
||||
|
@ -278,7 +278,7 @@ fn analyze(
|
|||
original_token: &SyntaxToken,
|
||||
self_token: &SyntaxToken,
|
||||
) -> Option<(CompletionAnalysis, (Option<Type>, Option<ast::NameOrNameRef>), QualifierCtx)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "CompletionContext::analyze").entered();
|
||||
let _p = tracing::info_span!("CompletionContext::analyze").entered();
|
||||
let ExpansionResult { original_file, speculative_file, offset, fake_ident_token, derive_ctx } =
|
||||
expansion_result;
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ impl Builder {
|
|||
}
|
||||
|
||||
pub(crate) fn build(self, db: &RootDatabase) -> CompletionItem {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "item::Builder::build").entered();
|
||||
let _p = tracing::info_span!("item::Builder::build").entered();
|
||||
|
||||
let label = self.label;
|
||||
let mut label_detail = None;
|
||||
|
|
|
@ -238,7 +238,7 @@ pub fn resolve_completion_edits(
|
|||
FilePosition { file_id, offset }: FilePosition,
|
||||
imports: impl IntoIterator<Item = (String, String)>,
|
||||
) -> Option<Vec<TextEdit>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "resolve_completion_edits").entered();
|
||||
let _p = tracing::info_span!("resolve_completion_edits").entered();
|
||||
let sema = hir::Semantics::new(db);
|
||||
|
||||
let original_file = sema.parse(file_id);
|
||||
|
|
|
@ -353,7 +353,7 @@ fn render_resolution_pat(
|
|||
import_to_add: Option<LocatedImport>,
|
||||
resolution: ScopeDef,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_resolution_pat").entered();
|
||||
let _p = tracing::info_span!("render_resolution_pat").entered();
|
||||
use hir::ModuleDef::*;
|
||||
|
||||
if let ScopeDef::ModuleDef(Macro(mac)) = resolution {
|
||||
|
@ -371,7 +371,7 @@ fn render_resolution_path(
|
|||
import_to_add: Option<LocatedImport>,
|
||||
resolution: ScopeDef,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_resolution_path").entered();
|
||||
let _p = tracing::info_span!("render_resolution_path").entered();
|
||||
use hir::ModuleDef::*;
|
||||
|
||||
match resolution {
|
||||
|
@ -479,7 +479,7 @@ fn render_resolution_simple_(
|
|||
import_to_add: Option<LocatedImport>,
|
||||
resolution: ScopeDef,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_resolution_simple_").entered();
|
||||
let _p = tracing::info_span!("render_resolution_simple_").entered();
|
||||
|
||||
let db = ctx.db();
|
||||
let ctx = ctx.import_to_add(import_to_add);
|
||||
|
|
|
@ -6,7 +6,7 @@ use ide_db::SymbolKind;
|
|||
use crate::{item::CompletionItem, render::RenderContext};
|
||||
|
||||
pub(crate) fn render_const(ctx: RenderContext<'_>, const_: hir::Const) -> Option<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_const").entered();
|
||||
let _p = tracing::info_span!("render_const").entered();
|
||||
render(ctx, const_)
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ pub(crate) fn render_fn(
|
|||
local_name: Option<hir::Name>,
|
||||
func: hir::Function,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_fn").entered();
|
||||
let _p = tracing::info_span!("render_fn").entered();
|
||||
render(ctx, local_name, func, FuncKind::Function(path_ctx))
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ pub(crate) fn render_method(
|
|||
local_name: Option<hir::Name>,
|
||||
func: hir::Function,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_method").entered();
|
||||
let _p = tracing::info_span!("render_method").entered();
|
||||
render(ctx, local_name, func, FuncKind::Method(dot_access, receiver))
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ pub(crate) fn render_variant_lit(
|
|||
variant: hir::Variant,
|
||||
path: Option<hir::ModPath>,
|
||||
) -> Option<Builder> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_variant_lit").entered();
|
||||
let _p = tracing::info_span!("render_variant_lit").entered();
|
||||
let db = ctx.db();
|
||||
|
||||
let name = local_name.unwrap_or_else(|| variant.name(db));
|
||||
|
@ -41,7 +41,7 @@ pub(crate) fn render_struct_literal(
|
|||
path: Option<hir::ModPath>,
|
||||
local_name: Option<hir::Name>,
|
||||
) -> Option<Builder> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_struct_literal").entered();
|
||||
let _p = tracing::info_span!("render_struct_literal").entered();
|
||||
let db = ctx.db();
|
||||
|
||||
let name = local_name.unwrap_or_else(|| strukt.name(db));
|
||||
|
|
|
@ -17,7 +17,7 @@ pub(crate) fn render_macro(
|
|||
name: hir::Name,
|
||||
macro_: hir::Macro,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_macro").entered();
|
||||
let _p = tracing::info_span!("render_macro").entered();
|
||||
render(ctx, *kind == PathKind::Use, *has_macro_bang, *has_call_parens, name, macro_)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ pub(crate) fn render_macro_pat(
|
|||
name: hir::Name,
|
||||
macro_: hir::Macro,
|
||||
) -> Builder {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_macro_pat").entered();
|
||||
let _p = tracing::info_span!("render_macro_pat").entered();
|
||||
render(ctx, false, false, false, name, macro_)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub(crate) fn render_struct_pat(
|
|||
strukt: hir::Struct,
|
||||
local_name: Option<Name>,
|
||||
) -> Option<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_struct_pat").entered();
|
||||
let _p = tracing::info_span!("render_struct_pat").entered();
|
||||
|
||||
let fields = strukt.fields(ctx.db());
|
||||
let (visible_fields, fields_omitted) = visible_fields(ctx.completion, &fields, strukt)?;
|
||||
|
@ -50,7 +50,7 @@ pub(crate) fn render_variant_pat(
|
|||
local_name: Option<Name>,
|
||||
path: Option<&hir::ModPath>,
|
||||
) -> Option<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_variant_pat").entered();
|
||||
let _p = tracing::info_span!("render_variant_pat").entered();
|
||||
|
||||
let fields = variant.fields(ctx.db());
|
||||
let (visible_fields, fields_omitted) = visible_fields(ctx.completion, &fields, variant)?;
|
||||
|
|
|
@ -10,7 +10,7 @@ pub(crate) fn render_type_alias(
|
|||
ctx: RenderContext<'_>,
|
||||
type_alias: hir::TypeAlias,
|
||||
) -> Option<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_type_alias").entered();
|
||||
let _p = tracing::info_span!("render_type_alias").entered();
|
||||
render(ctx, type_alias, false)
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub(crate) fn render_type_alias_with_eq(
|
|||
ctx: RenderContext<'_>,
|
||||
type_alias: hir::TypeAlias,
|
||||
) -> Option<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "render_type_alias_with_eq").entered();
|
||||
let _p = tracing::info_span!("render_type_alias_with_eq").entered();
|
||||
render(ctx, type_alias, true)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,13 +15,12 @@ use crate::{symbol_index::SymbolsDatabase, ChangeWithProcMacros, RootDatabase};
|
|||
|
||||
impl RootDatabase {
|
||||
pub fn request_cancellation(&mut self) {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "RootDatabase::request_cancellation").entered();
|
||||
let _p = tracing::info_span!("RootDatabase::request_cancellation").entered();
|
||||
self.synthetic_write(Durability::LOW);
|
||||
}
|
||||
|
||||
pub fn apply_change(&mut self, change: ChangeWithProcMacros) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "RootDatabase::apply_change").entered();
|
||||
let _p = tracing::info_span!("RootDatabase::apply_change").entered();
|
||||
self.request_cancellation();
|
||||
tracing::trace!("apply_change {:?}", change);
|
||||
if let Some(roots) = &change.source_change.roots {
|
||||
|
|
|
@ -413,7 +413,7 @@ impl NameClass {
|
|||
}
|
||||
|
||||
pub fn classify(sema: &Semantics<'_, RootDatabase>, name: &ast::Name) -> Option<NameClass> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "NameClass::classify").entered();
|
||||
let _p = tracing::info_span!("NameClass::classify").entered();
|
||||
|
||||
let parent = name.syntax().parent()?;
|
||||
|
||||
|
@ -505,8 +505,7 @@ impl NameClass {
|
|||
sema: &Semantics<'_, RootDatabase>,
|
||||
lifetime: &ast::Lifetime,
|
||||
) -> Option<NameClass> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "NameClass::classify_lifetime", ?lifetime)
|
||||
.entered();
|
||||
let _p = tracing::info_span!("NameClass::classify_lifetime", ?lifetime).entered();
|
||||
let parent = lifetime.syntax().parent()?;
|
||||
|
||||
if let Some(it) = ast::LifetimeParam::cast(parent.clone()) {
|
||||
|
@ -597,8 +596,7 @@ impl NameRefClass {
|
|||
sema: &Semantics<'_, RootDatabase>,
|
||||
name_ref: &ast::NameRef,
|
||||
) -> Option<NameRefClass> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "NameRefClass::classify", ?name_ref).entered();
|
||||
let _p = tracing::info_span!("NameRefClass::classify", ?name_ref).entered();
|
||||
|
||||
let parent = name_ref.syntax().parent()?;
|
||||
|
||||
|
@ -697,8 +695,7 @@ impl NameRefClass {
|
|||
sema: &Semantics<'_, RootDatabase>,
|
||||
lifetime: &ast::Lifetime,
|
||||
) -> Option<NameRefClass> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "NameRefClass::classify_lifetime", ?lifetime)
|
||||
.entered();
|
||||
let _p = tracing::info_span!("NameRefClass::classify_lifetime", ?lifetime).entered();
|
||||
if lifetime.text() == "'static" {
|
||||
return Some(NameRefClass::Definition(Definition::BuiltinLifetime(StaticLifetime)));
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ pub fn pick_token<T: AstToken>(mut tokens: TokenAtOffset<SyntaxToken>) -> Option
|
|||
|
||||
/// Converts the mod path struct into its ast representation.
|
||||
pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "mod_path_to_ast").entered();
|
||||
let _p = tracing::info_span!("mod_path_to_ast").entered();
|
||||
|
||||
let mut segments = Vec::new();
|
||||
let mut is_abs = false;
|
||||
|
|
|
@ -208,7 +208,7 @@ impl ImportAssets {
|
|||
cfg: ImportPathConfig,
|
||||
prefix_kind: PrefixKind,
|
||||
) -> impl Iterator<Item = LocatedImport> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for_imports").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::search_for_imports").entered();
|
||||
self.search_for(sema, Some(prefix_kind), cfg)
|
||||
}
|
||||
|
||||
|
@ -218,8 +218,7 @@ impl ImportAssets {
|
|||
sema: &Semantics<'_, RootDatabase>,
|
||||
cfg: ImportPathConfig,
|
||||
) -> impl Iterator<Item = LocatedImport> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for_relative_paths")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("ImportAssets::search_for_relative_paths").entered();
|
||||
self.search_for(sema, None, cfg)
|
||||
}
|
||||
|
||||
|
@ -259,7 +258,7 @@ impl ImportAssets {
|
|||
prefixed: Option<PrefixKind>,
|
||||
cfg: ImportPathConfig,
|
||||
) -> impl Iterator<Item = LocatedImport> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::search_for").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::search_for").entered();
|
||||
|
||||
let scope = match sema.scope(&self.candidate_node) {
|
||||
Some(it) => it,
|
||||
|
@ -303,7 +302,7 @@ impl ImportAssets {
|
|||
}
|
||||
|
||||
fn scope_definitions(&self, sema: &Semantics<'_, RootDatabase>) -> FxHashSet<ScopeDef> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::scope_definitions").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::scope_definitions").entered();
|
||||
let mut scope_definitions = FxHashSet::default();
|
||||
if let Some(scope) = sema.scope(&self.candidate_node) {
|
||||
scope.process_all_names(&mut |_, scope_def| {
|
||||
|
@ -321,8 +320,7 @@ fn path_applicable_imports(
|
|||
mod_path: impl Fn(ItemInNs) -> Option<ModPath> + Copy,
|
||||
scope_filter: impl Fn(ItemInNs) -> bool + Copy,
|
||||
) -> FxHashSet<LocatedImport> {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "ImportAssets::path_applicable_imports").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::path_applicable_imports").entered();
|
||||
|
||||
match &path_candidate.qualifier {
|
||||
None => {
|
||||
|
@ -369,7 +367,7 @@ fn import_for_item(
|
|||
original_item: ItemInNs,
|
||||
scope_filter: impl Fn(ItemInNs) -> bool,
|
||||
) -> Option<LocatedImport> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::import_for_item").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::import_for_item").entered();
|
||||
let [first_segment, ..] = unresolved_qualifier else { return None };
|
||||
|
||||
let item_as_assoc = item_as_assoc(db, original_item);
|
||||
|
@ -503,7 +501,7 @@ fn trait_applicable_items(
|
|||
mod_path: impl Fn(ItemInNs) -> Option<ModPath>,
|
||||
scope_filter: impl Fn(hir::Trait) -> bool,
|
||||
) -> FxHashSet<LocatedImport> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ImportAssets::trait_applicable_items").entered();
|
||||
let _p = tracing::info_span!("ImportAssets::trait_applicable_items").entered();
|
||||
|
||||
let db = sema.db;
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ fn insert_use_with_alias_option(
|
|||
cfg: &InsertUseConfig,
|
||||
alias: Option<ast::Rename>,
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "insert_use_with_alias_option").entered();
|
||||
let _p = tracing::info_span!("insert_use_with_alias_option").entered();
|
||||
let mut mb = match cfg.granularity {
|
||||
ImportGranularity::Crate => Some(MergeBehavior::Crate),
|
||||
ImportGranularity::Module => Some(MergeBehavior::Module),
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn items_with_name<'a>(
|
|||
assoc_item_search: AssocSearchMode,
|
||||
) -> impl Iterator<Item = ItemInNs> + 'a {
|
||||
let krate_name = krate.display_name(sema.db).map(|name| name.to_string());
|
||||
let _p = tracing::span!(tracing::Level::INFO, "items_with_name", name = name.text(), assoc_item_search = ?assoc_item_search, crate = ?krate_name)
|
||||
let _p = tracing::info_span!("items_with_name", name = name.text(), assoc_item_search = ?assoc_item_search, crate = ?krate_name)
|
||||
.entered();
|
||||
|
||||
let prefix = matches!(name, NameToImport::Prefix(..));
|
||||
|
@ -72,7 +72,7 @@ fn find_items<'a>(
|
|||
local_query: symbol_index::Query,
|
||||
external_query: import_map::Query,
|
||||
) -> impl Iterator<Item = ItemInNs> + 'a {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "find_items").entered();
|
||||
let _p = tracing::info_span!("find_items").entered();
|
||||
let db = sema.db;
|
||||
|
||||
// NOTE: `external_query` includes `assoc_item_search`, so we don't need to
|
||||
|
|
|
@ -32,7 +32,7 @@ pub fn parallel_prime_caches(
|
|||
num_worker_threads: u8,
|
||||
cb: &(dyn Fn(ParallelPrimeCachesProgress) + Sync),
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parallel_prime_caches").entered();
|
||||
let _p = tracing::info_span!("parallel_prime_caches").entered();
|
||||
|
||||
let graph = db.crate_graph();
|
||||
let mut crates_to_prime = {
|
||||
|
|
|
@ -266,7 +266,7 @@ impl IntoIterator for SearchScope {
|
|||
|
||||
impl Definition {
|
||||
fn search_scope(&self, db: &RootDatabase) -> SearchScope {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "search_scope").entered();
|
||||
let _p = tracing::info_span!("search_scope").entered();
|
||||
|
||||
if let Definition::BuiltinType(_) = self {
|
||||
return SearchScope::crate_graph(db);
|
||||
|
@ -434,7 +434,7 @@ impl<'a> FindUsages<'a> {
|
|||
}
|
||||
|
||||
pub fn search(&self, sink: &mut dyn FnMut(FileId, FileReference) -> bool) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "FindUsages:search").entered();
|
||||
let _p = tracing::info_span!("FindUsages:search").entered();
|
||||
let sema = self.sema;
|
||||
|
||||
let search_scope = {
|
||||
|
|
|
@ -124,7 +124,7 @@ pub trait SymbolsDatabase: HirDatabase + SourceDatabaseExt + Upcast<dyn HirDatab
|
|||
}
|
||||
|
||||
fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Arc<SymbolIndex> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "library_symbols").entered();
|
||||
let _p = tracing::info_span!("library_symbols").entered();
|
||||
|
||||
let mut symbol_collector = SymbolCollector::new(db.upcast());
|
||||
|
||||
|
@ -142,14 +142,14 @@ fn library_symbols(db: &dyn SymbolsDatabase, source_root_id: SourceRootId) -> Ar
|
|||
}
|
||||
|
||||
fn module_symbols(db: &dyn SymbolsDatabase, module: Module) -> Arc<SymbolIndex> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "module_symbols").entered();
|
||||
let _p = tracing::info_span!("module_symbols").entered();
|
||||
|
||||
let symbols = SymbolCollector::collect_module(db.upcast(), module);
|
||||
Arc::new(SymbolIndex::new(symbols))
|
||||
}
|
||||
|
||||
pub fn crate_symbols(db: &dyn SymbolsDatabase, krate: Crate) -> Box<[Arc<SymbolIndex>]> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "crate_symbols").entered();
|
||||
let _p = tracing::info_span!("crate_symbols").entered();
|
||||
krate.modules(db.upcast()).into_iter().map(|module| db.module_symbols(module)).collect()
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ impl<DB> std::ops::Deref for Snap<DB> {
|
|||
// | VS Code | kbd:[Ctrl+T]
|
||||
// |===
|
||||
pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "world_symbols", query = ?query.query).entered();
|
||||
let _p = tracing::info_span!("world_symbols", query = ?query.query).entered();
|
||||
|
||||
let indices: Vec<_> = if query.libs {
|
||||
db.library_roots()
|
||||
|
@ -321,7 +321,7 @@ impl Query {
|
|||
indices: &'sym [Arc<SymbolIndex>],
|
||||
cb: impl FnMut(&'sym FileSymbol),
|
||||
) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "symbol_index::Query::search").entered();
|
||||
let _p = tracing::info_span!("symbol_index::Query::search").entered();
|
||||
let mut op = fst::map::OpBuilder::new();
|
||||
match self.mode {
|
||||
SearchMode::Exact => {
|
||||
|
|
|
@ -297,7 +297,7 @@ pub fn diagnostics(
|
|||
resolve: &AssistResolveStrategy,
|
||||
file_id: FileId,
|
||||
) -> Vec<Diagnostic> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered();
|
||||
let _p = tracing::info_span!("diagnostics").entered();
|
||||
let sema = Semantics::new(db);
|
||||
let mut res = Vec::new();
|
||||
|
||||
|
@ -482,7 +482,7 @@ fn handle_lint_attributes(
|
|||
clippy_stack: &mut FxHashMap<String, Vec<Severity>>,
|
||||
diagnostics_of_range: &mut FxHashMap<InFile<SyntaxNode>, &mut Diagnostic>,
|
||||
) {
|
||||
let _g = tracing::span!(tracing::Level::INFO, "handle_lint_attributes").entered();
|
||||
let _g = tracing::info_span!("handle_lint_attributes").entered();
|
||||
let file_id = sema.hir_file_for(root);
|
||||
let preorder = root.preorder();
|
||||
for ev in preorder {
|
||||
|
|
|
@ -55,7 +55,7 @@ pub(crate) fn highlight_related(
|
|||
config: HighlightRelatedConfig,
|
||||
pos @ FilePosition { offset, file_id }: FilePosition,
|
||||
) -> Option<Vec<HighlightedRange>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "highlight_related").entered();
|
||||
let _p = tracing::info_span!("highlight_related").entered();
|
||||
let syntax = sema.parse(file_id).syntax().clone();
|
||||
|
||||
let token = pick_best_token(syntax.token_at_offset(offset), |kind| match kind {
|
||||
|
|
|
@ -462,7 +462,7 @@ pub(crate) fn inlay_hints(
|
|||
range_limit: Option<TextRange>,
|
||||
config: &InlayHintsConfig,
|
||||
) -> Vec<InlayHint> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "inlay_hints").entered();
|
||||
let _p = tracing::info_span!("inlay_hints").entered();
|
||||
let sema = Semantics::new(db);
|
||||
let file = sema.parse(file_id);
|
||||
let file = file.syntax();
|
||||
|
@ -496,7 +496,7 @@ pub(crate) fn inlay_hints_resolve(
|
|||
config: &InlayHintsConfig,
|
||||
hasher: impl Fn(&InlayHint) -> u64,
|
||||
) -> Option<InlayHint> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "inlay_hints_resolve").entered();
|
||||
let _p = tracing::info_span!("inlay_hints_resolve").entered();
|
||||
let sema = Semantics::new(db);
|
||||
let file = sema.parse(file_id);
|
||||
let file = file.syntax();
|
||||
|
|
|
@ -55,7 +55,7 @@ pub(crate) fn find_all_refs(
|
|||
position: FilePosition,
|
||||
search_scope: Option<SearchScope>,
|
||||
) -> Option<Vec<ReferenceSearchResult>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "find_all_refs").entered();
|
||||
let _p = tracing::info_span!("find_all_refs").entered();
|
||||
let syntax = sema.parse(position.file_id).syntax().clone();
|
||||
let make_searcher = |literal_search: bool| {
|
||||
move |def: Definition| {
|
||||
|
|
|
@ -186,7 +186,7 @@ pub(crate) fn highlight(
|
|||
file_id: FileId,
|
||||
range_to_highlight: Option<TextRange>,
|
||||
) -> Vec<HlRange> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "highlight").entered();
|
||||
let _p = tracing::info_span!("highlight").entered();
|
||||
let sema = Semantics::new(db);
|
||||
|
||||
// Determine the root based on the given range.
|
||||
|
|
|
@ -17,7 +17,7 @@ use itertools::Itertools;
|
|||
use proc_macro_api::{MacroDylib, ProcMacroServer};
|
||||
use project_model::{CargoConfig, PackageRoot, ProjectManifest, ProjectWorkspace};
|
||||
use span::Span;
|
||||
use tracing::{instrument, Level};
|
||||
use tracing::instrument;
|
||||
use vfs::{file_set::FileSetConfig, loader::Handle, AbsPath, AbsPathBuf, VfsPath};
|
||||
|
||||
pub struct LoadCargoConfig {
|
||||
|
@ -352,8 +352,8 @@ fn load_crate_graph(
|
|||
}
|
||||
}
|
||||
vfs::loader::Message::Loaded { files } | vfs::loader::Message::Changed { files } => {
|
||||
let _p = tracing::span!(Level::INFO, "load_cargo::load_crate_craph/LoadedChanged")
|
||||
.entered();
|
||||
let _p =
|
||||
tracing::info_span!("load_cargo::load_crate_craph/LoadedChanged").entered();
|
||||
for (path, contents) in files {
|
||||
vfs.set_file_contents(path.into(), contents);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ struct LexError {
|
|||
|
||||
impl<'a> LexedStr<'a> {
|
||||
pub fn new(text: &'a str) -> LexedStr<'a> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "LexedStr::new").entered();
|
||||
let _p = tracing::info_span!("LexedStr::new").entered();
|
||||
let mut conv = Converter::new(text);
|
||||
if let Some(shebang_len) = rustc_lexer::strip_shebang(text) {
|
||||
conv.res.push(SHEBANG, conv.offset);
|
||||
|
|
|
@ -89,7 +89,7 @@ pub enum TopEntryPoint {
|
|||
|
||||
impl TopEntryPoint {
|
||||
pub fn parse(&self, input: &Input, edition: Edition) -> Output {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "TopEntryPoint::parse", ?self).entered();
|
||||
let _p = tracing::info_span!("TopEntryPoint::parse", ?self).entered();
|
||||
let entry_point: fn(&'_ mut parser::Parser<'_>) = match self {
|
||||
TopEntryPoint::SourceFile => grammar::entry::top::source_file,
|
||||
TopEntryPoint::MacroStmts => grammar::entry::top::macro_stmts,
|
||||
|
|
|
@ -26,7 +26,7 @@ pub enum StrStep<'a> {
|
|||
|
||||
impl LexedStr<'_> {
|
||||
pub fn to_input(&self) -> crate::Input {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "LexedStr::to_input").entered();
|
||||
let _p = tracing::info_span!("LexedStr::to_input").entered();
|
||||
let mut res = crate::Input::default();
|
||||
let mut was_joint = false;
|
||||
for i in 0..self.len() {
|
||||
|
|
|
@ -129,7 +129,7 @@ impl ProcMacroServer {
|
|||
}
|
||||
|
||||
pub fn load_dylib(&self, dylib: MacroDylib) -> Result<Vec<ProcMacro>, ServerError> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ProcMacroServer::load_dylib").entered();
|
||||
let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered();
|
||||
let macros =
|
||||
self.process.lock().unwrap_or_else(|e| e.into_inner()).find_proc_macros(&dylib.path)?;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ pub(crate) fn get(
|
|||
extra_env: &FxHashMap<String, String>,
|
||||
config: RustcCfgConfig<'_>,
|
||||
) -> Vec<CfgFlag> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "rustc_cfg::get").entered();
|
||||
let _p = tracing::info_span!("rustc_cfg::get").entered();
|
||||
let mut res = Vec::with_capacity(6 * 2 + 1);
|
||||
|
||||
// Some nightly-only cfgs, which are required for stdlib
|
||||
|
|
|
@ -705,7 +705,7 @@ impl ProjectWorkspace {
|
|||
load: FileLoader<'_>,
|
||||
extra_env: &FxHashMap<String, String>,
|
||||
) -> (CrateGraph, ProcMacroPaths) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "ProjectWorkspace::to_crate_graph").entered();
|
||||
let _p = tracing::info_span!("ProjectWorkspace::to_crate_graph").entered();
|
||||
|
||||
let Self { kind, sysroot, cfg_overrides, rustc_cfg, .. } = self;
|
||||
let ((mut crate_graph, proc_macros), sysroot) = match kind {
|
||||
|
@ -949,7 +949,7 @@ fn cargo_to_crate_graph(
|
|||
override_cfg: &CfgOverrides,
|
||||
build_scripts: &WorkspaceBuildScripts,
|
||||
) -> (CrateGraph, ProcMacroPaths) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "cargo_to_crate_graph").entered();
|
||||
let _p = tracing::info_span!("cargo_to_crate_graph").entered();
|
||||
let mut res = (CrateGraph::default(), ProcMacroPaths::default());
|
||||
let crate_graph = &mut res.0;
|
||||
let proc_macros = &mut res.1;
|
||||
|
@ -1134,7 +1134,7 @@ fn detached_file_to_crate_graph(
|
|||
sysroot: &Sysroot,
|
||||
override_cfg: &CfgOverrides,
|
||||
) -> (CrateGraph, ProcMacroPaths) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "detached_file_to_crate_graph").entered();
|
||||
let _p = tracing::info_span!("detached_file_to_crate_graph").entered();
|
||||
let mut crate_graph = CrateGraph::default();
|
||||
let (public_deps, _libproc_macro) =
|
||||
sysroot_to_crate_graph(&mut crate_graph, sysroot, rustc_cfg.clone(), load);
|
||||
|
@ -1365,7 +1365,7 @@ fn sysroot_to_crate_graph(
|
|||
rustc_cfg: Vec<CfgFlag>,
|
||||
load: FileLoader<'_>,
|
||||
) -> (SysrootPublicDeps, Option<CrateId>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "sysroot_to_crate_graph").entered();
|
||||
let _p = tracing::info_span!("sysroot_to_crate_graph").entered();
|
||||
match sysroot.mode() {
|
||||
SysrootMode::Workspace(cargo) => {
|
||||
let (mut cg, mut pm) = cargo_to_crate_graph(
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::cli::{flags, read_stdin};
|
|||
|
||||
impl flags::Parse {
|
||||
pub fn run(self) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "flags::Parse::run").entered();
|
||||
let _p = tracing::info_span!("flags::Parse::run").entered();
|
||||
let text = read_stdin()?;
|
||||
let file = SourceFile::parse(&text, Edition::CURRENT).tree();
|
||||
if !self.no_dump {
|
||||
|
|
|
@ -128,7 +128,7 @@ pub(crate) fn fetch_native_diagnostics(
|
|||
snapshot: GlobalStateSnapshot,
|
||||
subscriptions: Vec<FileId>,
|
||||
) -> Vec<(FileId, Vec<lsp_types::Diagnostic>)> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "fetch_native_diagnostics").entered();
|
||||
let _p = tracing::info_span!("fetch_native_diagnostics").entered();
|
||||
let _ctx = stdx::panic_context::enter("fetch_native_diagnostics".to_owned());
|
||||
|
||||
let convert_diagnostic =
|
||||
|
|
|
@ -52,7 +52,8 @@ impl RequestDispatcher<'_> {
|
|||
Some(it) => it,
|
||||
None => return self,
|
||||
};
|
||||
let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
let _guard =
|
||||
tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
tracing::debug!(?params);
|
||||
let result = {
|
||||
let _pctx = stdx::panic_context::enter(panic_context);
|
||||
|
@ -79,7 +80,8 @@ impl RequestDispatcher<'_> {
|
|||
Some(it) => it,
|
||||
None => return self,
|
||||
};
|
||||
let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
let _guard =
|
||||
tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
tracing::debug!(?params);
|
||||
let global_state_snapshot = self.global_state.snapshot();
|
||||
|
||||
|
@ -162,7 +164,8 @@ impl RequestDispatcher<'_> {
|
|||
Some(it) => it,
|
||||
None => return self,
|
||||
};
|
||||
let _guard = tracing::span!(tracing::Level::INFO, "request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
let _guard =
|
||||
tracing::info_span!("request", method = ?req.method, "request_id" = ?req.id).entered();
|
||||
tracing::debug!(?params);
|
||||
|
||||
let world = self.global_state.snapshot();
|
||||
|
@ -297,8 +300,7 @@ impl NotificationDispatcher<'_> {
|
|||
None => return Ok(self),
|
||||
};
|
||||
|
||||
let _guard =
|
||||
tracing::span!(tracing::Level::INFO, "notification", method = ?not.method).entered();
|
||||
let _guard = tracing::info_span!("notification", method = ?not.method).entered();
|
||||
|
||||
let params = match not.extract::<N::Params>(N::METHOD) {
|
||||
Ok(it) => it,
|
||||
|
|
|
@ -54,7 +54,7 @@ pub(crate) fn handle_did_open_text_document(
|
|||
state: &mut GlobalState,
|
||||
params: DidOpenTextDocumentParams,
|
||||
) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_did_open_text_document").entered();
|
||||
let _p = tracing::info_span!("handle_did_open_text_document").entered();
|
||||
|
||||
if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) {
|
||||
let already_exists = state
|
||||
|
@ -87,7 +87,7 @@ pub(crate) fn handle_did_change_text_document(
|
|||
state: &mut GlobalState,
|
||||
params: DidChangeTextDocumentParams,
|
||||
) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_did_change_text_document").entered();
|
||||
let _p = tracing::info_span!("handle_did_change_text_document").entered();
|
||||
|
||||
if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) {
|
||||
let Some(DocumentData { version, data }) = state.mem_docs.get_mut(&path) else {
|
||||
|
@ -116,7 +116,7 @@ pub(crate) fn handle_did_close_text_document(
|
|||
state: &mut GlobalState,
|
||||
params: DidCloseTextDocumentParams,
|
||||
) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_did_close_text_document").entered();
|
||||
let _p = tracing::info_span!("handle_did_close_text_document").entered();
|
||||
|
||||
if let Ok(path) = from_proto::vfs_path(¶ms.text_document.uri) {
|
||||
if state.mem_docs.remove(&path).is_err() {
|
||||
|
@ -254,7 +254,7 @@ pub(crate) fn handle_did_change_watched_files(
|
|||
}
|
||||
|
||||
fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "run_flycheck").entered();
|
||||
let _p = tracing::info_span!("run_flycheck").entered();
|
||||
|
||||
let file_id = state.vfs.read().0.file_id(&vfs_path);
|
||||
if let Some(file_id) = file_id {
|
||||
|
@ -349,13 +349,13 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
|
|||
}
|
||||
|
||||
pub(crate) fn handle_cancel_flycheck(state: &mut GlobalState, _: ()) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_cancel_flycheck").entered();
|
||||
let _p = tracing::info_span!("handle_cancel_flycheck").entered();
|
||||
state.flycheck.iter().for_each(|flycheck| flycheck.cancel());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn handle_clear_flycheck(state: &mut GlobalState, _: ()) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_clear_flycheck").entered();
|
||||
let _p = tracing::info_span!("handle_clear_flycheck").entered();
|
||||
state.diagnostics.clear_check_all();
|
||||
Ok(())
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ pub(crate) fn handle_run_flycheck(
|
|||
state: &mut GlobalState,
|
||||
params: RunFlycheckParams,
|
||||
) -> anyhow::Result<()> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_run_flycheck").entered();
|
||||
let _p = tracing::info_span!("handle_run_flycheck").entered();
|
||||
if let Some(text_document) = params.text_document {
|
||||
if let Ok(vfs_path) = from_proto::vfs_path(&text_document.uri) {
|
||||
if run_flycheck(state, vfs_path) {
|
||||
|
|
|
@ -72,7 +72,7 @@ pub(crate) fn handle_analyzer_status(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::AnalyzerStatusParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_analyzer_status").entered();
|
||||
let _p = tracing::info_span!("handle_analyzer_status").entered();
|
||||
|
||||
let mut buf = String::new();
|
||||
|
||||
|
@ -113,7 +113,7 @@ pub(crate) fn handle_analyzer_status(
|
|||
}
|
||||
|
||||
pub(crate) fn handle_memory_usage(state: &mut GlobalState, _: ()) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_memory_usage").entered();
|
||||
let _p = tracing::info_span!("handle_memory_usage").entered();
|
||||
let mem = state.analysis_host.per_query_memory_usage();
|
||||
|
||||
let mut out = String::new();
|
||||
|
@ -134,7 +134,7 @@ pub(crate) fn handle_syntax_tree(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::SyntaxTreeParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_syntax_tree").entered();
|
||||
let _p = tracing::info_span!("handle_syntax_tree").entered();
|
||||
let id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(id)?;
|
||||
let text_range = params.range.and_then(|r| from_proto::text_range(&line_index, r).ok());
|
||||
|
@ -146,7 +146,7 @@ pub(crate) fn handle_view_hir(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_view_hir").entered();
|
||||
let _p = tracing::info_span!("handle_view_hir").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
let res = snap.analysis.view_hir(position)?;
|
||||
Ok(res)
|
||||
|
@ -156,7 +156,7 @@ pub(crate) fn handle_view_mir(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_view_mir").entered();
|
||||
let _p = tracing::info_span!("handle_view_mir").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
let res = snap.analysis.view_mir(position)?;
|
||||
Ok(res)
|
||||
|
@ -166,7 +166,7 @@ pub(crate) fn handle_interpret_function(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_interpret_function").entered();
|
||||
let _p = tracing::info_span!("handle_interpret_function").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
let res = snap.analysis.interpret_function(position)?;
|
||||
Ok(res)
|
||||
|
@ -184,7 +184,7 @@ pub(crate) fn handle_view_item_tree(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::ViewItemTreeParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_view_item_tree").entered();
|
||||
let _p = tracing::info_span!("handle_view_item_tree").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let res = snap.analysis.view_item_tree(file_id)?;
|
||||
Ok(res)
|
||||
|
@ -245,7 +245,7 @@ pub(crate) fn handle_discover_test(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::DiscoverTestParams,
|
||||
) -> anyhow::Result<lsp_ext::DiscoverTestResults> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_discover_test").entered();
|
||||
let _p = tracing::info_span!("handle_discover_test").entered();
|
||||
let (tests, scope) = match params.test_id {
|
||||
Some(id) => {
|
||||
let crate_id = id.split_once("::").map(|it| it.0).unwrap_or(&id);
|
||||
|
@ -276,7 +276,7 @@ pub(crate) fn handle_view_crate_graph(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: ViewCrateGraphParams,
|
||||
) -> anyhow::Result<String> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_view_crate_graph").entered();
|
||||
let _p = tracing::info_span!("handle_view_crate_graph").entered();
|
||||
let dot = snap.analysis.view_crate_graph(params.full)?.map_err(anyhow::Error::msg)?;
|
||||
Ok(dot)
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ pub(crate) fn handle_expand_macro(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::ExpandMacroParams,
|
||||
) -> anyhow::Result<Option<lsp_ext::ExpandedMacro>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_expand_macro").entered();
|
||||
let _p = tracing::info_span!("handle_expand_macro").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
let offset = from_proto::offset(&line_index, params.position)?;
|
||||
|
@ -298,7 +298,7 @@ pub(crate) fn handle_selection_range(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::SelectionRangeParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_types::SelectionRange>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_selection_range").entered();
|
||||
let _p = tracing::info_span!("handle_selection_range").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
let res: anyhow::Result<Vec<lsp_types::SelectionRange>> = params
|
||||
|
@ -341,7 +341,7 @@ pub(crate) fn handle_matching_brace(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::MatchingBraceParams,
|
||||
) -> anyhow::Result<Vec<Position>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_matching_brace").entered();
|
||||
let _p = tracing::info_span!("handle_matching_brace").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
params
|
||||
|
@ -364,7 +364,7 @@ pub(crate) fn handle_join_lines(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::JoinLinesParams,
|
||||
) -> anyhow::Result<Vec<lsp_types::TextEdit>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_join_lines").entered();
|
||||
let _p = tracing::info_span!("handle_join_lines").entered();
|
||||
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let source_root = snap.analysis.source_root(file_id)?;
|
||||
|
@ -390,7 +390,7 @@ pub(crate) fn handle_on_enter(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_ext::SnippetTextEdit>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_on_enter").entered();
|
||||
let _p = tracing::info_span!("handle_on_enter").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
let edit = match snap.analysis.on_enter(position)? {
|
||||
None => return Ok(None),
|
||||
|
@ -405,7 +405,7 @@ pub(crate) fn handle_on_type_formatting(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::DocumentOnTypeFormattingParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_ext::SnippetTextEdit>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_on_type_formatting").entered();
|
||||
let _p = tracing::info_span!("handle_on_type_formatting").entered();
|
||||
let mut position = from_proto::file_position(&snap, params.text_document_position)?;
|
||||
let line_index = snap.file_line_index(position.file_id)?;
|
||||
|
||||
|
@ -446,7 +446,7 @@ pub(crate) fn handle_document_symbol(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::DocumentSymbolParams,
|
||||
) -> anyhow::Result<Option<lsp_types::DocumentSymbolResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_document_symbol").entered();
|
||||
let _p = tracing::info_span!("handle_document_symbol").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
|
||||
|
@ -535,7 +535,7 @@ pub(crate) fn handle_workspace_symbol(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: WorkspaceSymbolParams,
|
||||
) -> anyhow::Result<Option<lsp_types::WorkspaceSymbolResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_workspace_symbol").entered();
|
||||
let _p = tracing::info_span!("handle_workspace_symbol").entered();
|
||||
|
||||
let config = snap.config.workspace_symbol();
|
||||
let (all_symbols, libs) = decide_search_scope_and_kind(¶ms, &config);
|
||||
|
@ -627,7 +627,7 @@ pub(crate) fn handle_will_rename_files(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::RenameFilesParams,
|
||||
) -> anyhow::Result<Option<lsp_types::WorkspaceEdit>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_will_rename_files").entered();
|
||||
let _p = tracing::info_span!("handle_will_rename_files").entered();
|
||||
|
||||
let source_changes: Vec<SourceChange> = params
|
||||
.files
|
||||
|
@ -689,7 +689,7 @@ pub(crate) fn handle_goto_definition(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::GotoDefinitionParams,
|
||||
) -> anyhow::Result<Option<lsp_types::GotoDefinitionResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_goto_definition").entered();
|
||||
let _p = tracing::info_span!("handle_goto_definition").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let nav_info = match snap.analysis.goto_definition(position)? {
|
||||
None => return Ok(None),
|
||||
|
@ -704,7 +704,7 @@ pub(crate) fn handle_goto_declaration(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::request::GotoDeclarationParams,
|
||||
) -> anyhow::Result<Option<lsp_types::request::GotoDeclarationResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_goto_declaration").entered();
|
||||
let _p = tracing::info_span!("handle_goto_declaration").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params.clone())?;
|
||||
let nav_info = match snap.analysis.goto_declaration(position)? {
|
||||
None => return handle_goto_definition(snap, params),
|
||||
|
@ -719,7 +719,7 @@ pub(crate) fn handle_goto_implementation(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::request::GotoImplementationParams,
|
||||
) -> anyhow::Result<Option<lsp_types::request::GotoImplementationResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_goto_implementation").entered();
|
||||
let _p = tracing::info_span!("handle_goto_implementation").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let nav_info = match snap.analysis.goto_implementation(position)? {
|
||||
None => return Ok(None),
|
||||
|
@ -734,7 +734,7 @@ pub(crate) fn handle_goto_type_definition(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::request::GotoTypeDefinitionParams,
|
||||
) -> anyhow::Result<Option<lsp_types::request::GotoTypeDefinitionResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_goto_type_definition").entered();
|
||||
let _p = tracing::info_span!("handle_goto_type_definition").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let nav_info = match snap.analysis.goto_type_definition(position)? {
|
||||
None => return Ok(None),
|
||||
|
@ -749,7 +749,7 @@ pub(crate) fn handle_parent_module(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<Option<lsp_types::GotoDefinitionResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_parent_module").entered();
|
||||
let _p = tracing::info_span!("handle_parent_module").entered();
|
||||
if let Ok(file_path) = ¶ms.text_document.uri.to_file_path() {
|
||||
if file_path.file_name().unwrap_or_default() == "Cargo.toml" {
|
||||
// search workspaces for parent packages or fallback to workspace root
|
||||
|
@ -819,7 +819,7 @@ pub(crate) fn handle_runnables(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::RunnablesParams,
|
||||
) -> anyhow::Result<Vec<lsp_ext::Runnable>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_runnables").entered();
|
||||
let _p = tracing::info_span!("handle_runnables").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
let offset = params.position.and_then(|it| from_proto::offset(&line_index, it).ok());
|
||||
|
@ -925,7 +925,7 @@ pub(crate) fn handle_related_tests(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<Vec<lsp_ext::TestInfo>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_related_tests").entered();
|
||||
let _p = tracing::info_span!("handle_related_tests").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
|
||||
let tests = snap.analysis.related_tests(position, None)?;
|
||||
|
@ -943,7 +943,7 @@ pub(crate) fn handle_completion(
|
|||
snap: GlobalStateSnapshot,
|
||||
lsp_types::CompletionParams { text_document_position, context,.. }: lsp_types::CompletionParams,
|
||||
) -> anyhow::Result<Option<lsp_types::CompletionResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_completion").entered();
|
||||
let _p = tracing::info_span!("handle_completion").entered();
|
||||
let mut position = from_proto::file_position(&snap, text_document_position.clone())?;
|
||||
let line_index = snap.file_line_index(position.file_id)?;
|
||||
let completion_trigger_character =
|
||||
|
@ -978,7 +978,7 @@ pub(crate) fn handle_completion_resolve(
|
|||
snap: GlobalStateSnapshot,
|
||||
mut original_completion: CompletionItem,
|
||||
) -> anyhow::Result<CompletionItem> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_completion_resolve").entered();
|
||||
let _p = tracing::info_span!("handle_completion_resolve").entered();
|
||||
|
||||
if !all_edits_are_disjoint(&original_completion, &[]) {
|
||||
return Err(invalid_params_error(
|
||||
|
@ -1035,7 +1035,7 @@ pub(crate) fn handle_folding_range(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: FoldingRangeParams,
|
||||
) -> anyhow::Result<Option<Vec<FoldingRange>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_folding_range").entered();
|
||||
let _p = tracing::info_span!("handle_folding_range").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let folds = snap.analysis.folding_ranges(file_id)?;
|
||||
let text = snap.analysis.file_text(file_id)?;
|
||||
|
@ -1052,7 +1052,7 @@ pub(crate) fn handle_signature_help(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::SignatureHelpParams,
|
||||
) -> anyhow::Result<Option<lsp_types::SignatureHelp>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_signature_help").entered();
|
||||
let _p = tracing::info_span!("handle_signature_help").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let help = match snap.analysis.signature_help(position)? {
|
||||
Some(it) => it,
|
||||
|
@ -1067,7 +1067,7 @@ pub(crate) fn handle_hover(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::HoverParams,
|
||||
) -> anyhow::Result<Option<lsp_ext::Hover>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_hover").entered();
|
||||
let _p = tracing::info_span!("handle_hover").entered();
|
||||
let range = match params.position {
|
||||
PositionOrRange::Position(position) => Range::new(position, position),
|
||||
PositionOrRange::Range(range) => range,
|
||||
|
@ -1105,7 +1105,7 @@ pub(crate) fn handle_prepare_rename(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<Option<PrepareRenameResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_prepare_rename").entered();
|
||||
let _p = tracing::info_span!("handle_prepare_rename").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
|
||||
let change = snap.analysis.prepare_rename(position)?.map_err(to_proto::rename_error)?;
|
||||
|
@ -1119,7 +1119,7 @@ pub(crate) fn handle_rename(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: RenameParams,
|
||||
) -> anyhow::Result<Option<WorkspaceEdit>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_rename").entered();
|
||||
let _p = tracing::info_span!("handle_rename").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position)?;
|
||||
|
||||
let mut change =
|
||||
|
@ -1154,7 +1154,7 @@ pub(crate) fn handle_references(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::ReferenceParams,
|
||||
) -> anyhow::Result<Option<Vec<Location>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_references").entered();
|
||||
let _p = tracing::info_span!("handle_references").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position)?;
|
||||
|
||||
let exclude_imports = snap.config.find_all_refs_exclude_imports();
|
||||
|
@ -1199,7 +1199,7 @@ pub(crate) fn handle_formatting(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::DocumentFormattingParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_types::TextEdit>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_formatting").entered();
|
||||
let _p = tracing::info_span!("handle_formatting").entered();
|
||||
|
||||
run_rustfmt(&snap, params.text_document, None)
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ pub(crate) fn handle_range_formatting(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::DocumentRangeFormattingParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_types::TextEdit>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_range_formatting").entered();
|
||||
let _p = tracing::info_span!("handle_range_formatting").entered();
|
||||
|
||||
run_rustfmt(&snap, params.text_document, Some(params.range))
|
||||
}
|
||||
|
@ -1217,7 +1217,7 @@ pub(crate) fn handle_code_action(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::CodeActionParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_ext::CodeAction>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_code_action").entered();
|
||||
let _p = tracing::info_span!("handle_code_action").entered();
|
||||
|
||||
if !snap.config.code_action_literals() {
|
||||
// We intentionally don't support command-based actions, as those either
|
||||
|
@ -1295,7 +1295,7 @@ pub(crate) fn handle_code_action_resolve(
|
|||
snap: GlobalStateSnapshot,
|
||||
mut code_action: lsp_ext::CodeAction,
|
||||
) -> anyhow::Result<lsp_ext::CodeAction> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_code_action_resolve").entered();
|
||||
let _p = tracing::info_span!("handle_code_action_resolve").entered();
|
||||
let Some(params) = code_action.data.take() else {
|
||||
return Err(invalid_params_error("code action without data".to_owned()).into());
|
||||
};
|
||||
|
@ -1388,7 +1388,7 @@ pub(crate) fn handle_code_lens(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::CodeLensParams,
|
||||
) -> anyhow::Result<Option<Vec<CodeLens>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_code_lens").entered();
|
||||
let _p = tracing::info_span!("handle_code_lens").entered();
|
||||
|
||||
let lens_config = snap.config.lens();
|
||||
if lens_config.none() {
|
||||
|
@ -1457,7 +1457,7 @@ pub(crate) fn handle_document_highlight(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::DocumentHighlightParams,
|
||||
) -> anyhow::Result<Option<Vec<lsp_types::DocumentHighlight>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_document_highlight").entered();
|
||||
let _p = tracing::info_span!("handle_document_highlight").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let line_index = snap.file_line_index(position.file_id)?;
|
||||
let source_root = snap.analysis.source_root(position.file_id)?;
|
||||
|
@ -1483,7 +1483,7 @@ pub(crate) fn handle_ssr(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::SsrParams,
|
||||
) -> anyhow::Result<lsp_types::WorkspaceEdit> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_ssr").entered();
|
||||
let _p = tracing::info_span!("handle_ssr").entered();
|
||||
let selections = params
|
||||
.selections
|
||||
.iter()
|
||||
|
@ -1503,7 +1503,7 @@ pub(crate) fn handle_inlay_hints(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: InlayHintParams,
|
||||
) -> anyhow::Result<Option<Vec<InlayHint>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_inlay_hints").entered();
|
||||
let _p = tracing::info_span!("handle_inlay_hints").entered();
|
||||
let document_uri = ¶ms.text_document.uri;
|
||||
let FileRange { file_id, range } = from_proto::file_range(
|
||||
&snap,
|
||||
|
@ -1539,7 +1539,7 @@ pub(crate) fn handle_inlay_hints_resolve(
|
|||
snap: GlobalStateSnapshot,
|
||||
mut original_hint: InlayHint,
|
||||
) -> anyhow::Result<InlayHint> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_inlay_hints_resolve").entered();
|
||||
let _p = tracing::info_span!("handle_inlay_hints_resolve").entered();
|
||||
|
||||
let Some(data) = original_hint.data.take() else { return Ok(original_hint) };
|
||||
let resolve_data: lsp_ext::InlayHintResolveData = serde_json::from_value(data)?;
|
||||
|
@ -1590,7 +1590,7 @@ pub(crate) fn handle_call_hierarchy_prepare(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: CallHierarchyPrepareParams,
|
||||
) -> anyhow::Result<Option<Vec<CallHierarchyItem>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_prepare").entered();
|
||||
let _p = tracing::info_span!("handle_call_hierarchy_prepare").entered();
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
|
||||
let nav_info = match snap.analysis.call_hierarchy(position)? {
|
||||
|
@ -1612,7 +1612,7 @@ pub(crate) fn handle_call_hierarchy_incoming(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: CallHierarchyIncomingCallsParams,
|
||||
) -> anyhow::Result<Option<Vec<CallHierarchyIncomingCall>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_incoming").entered();
|
||||
let _p = tracing::info_span!("handle_call_hierarchy_incoming").entered();
|
||||
let item = params.item;
|
||||
|
||||
let doc = TextDocumentIdentifier::new(item.uri);
|
||||
|
@ -1647,7 +1647,7 @@ pub(crate) fn handle_call_hierarchy_outgoing(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: CallHierarchyOutgoingCallsParams,
|
||||
) -> anyhow::Result<Option<Vec<CallHierarchyOutgoingCall>>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_call_hierarchy_outgoing").entered();
|
||||
let _p = tracing::info_span!("handle_call_hierarchy_outgoing").entered();
|
||||
let item = params.item;
|
||||
|
||||
let doc = TextDocumentIdentifier::new(item.uri);
|
||||
|
@ -1682,7 +1682,7 @@ pub(crate) fn handle_semantic_tokens_full(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: SemanticTokensParams,
|
||||
) -> anyhow::Result<Option<SemanticTokensResult>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_full").entered();
|
||||
let _p = tracing::info_span!("handle_semantic_tokens_full").entered();
|
||||
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let text = snap.analysis.file_text(file_id)?;
|
||||
|
@ -1713,7 +1713,7 @@ pub(crate) fn handle_semantic_tokens_full_delta(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: SemanticTokensDeltaParams,
|
||||
) -> anyhow::Result<Option<SemanticTokensFullDeltaResult>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_full_delta").entered();
|
||||
let _p = tracing::info_span!("handle_semantic_tokens_full_delta").entered();
|
||||
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let text = snap.analysis.file_text(file_id)?;
|
||||
|
@ -1757,7 +1757,7 @@ pub(crate) fn handle_semantic_tokens_range(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: SemanticTokensRangeParams,
|
||||
) -> anyhow::Result<Option<SemanticTokensRangeResult>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_semantic_tokens_range").entered();
|
||||
let _p = tracing::info_span!("handle_semantic_tokens_range").entered();
|
||||
|
||||
let frange = from_proto::file_range(&snap, ¶ms.text_document, params.range)?;
|
||||
let text = snap.analysis.file_text(frange.file_id)?;
|
||||
|
@ -1784,7 +1784,7 @@ pub(crate) fn handle_open_docs(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<ExternalDocsResponse> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_open_docs").entered();
|
||||
let _p = tracing::info_span!("handle_open_docs").entered();
|
||||
let position = from_proto::file_position(&snap, params)?;
|
||||
|
||||
let ws_and_sysroot = snap.workspaces.iter().find_map(|ws| match &ws.kind {
|
||||
|
@ -1826,7 +1826,7 @@ pub(crate) fn handle_open_cargo_toml(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::OpenCargoTomlParams,
|
||||
) -> anyhow::Result<Option<lsp_types::GotoDefinitionResponse>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_open_cargo_toml").entered();
|
||||
let _p = tracing::info_span!("handle_open_cargo_toml").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
|
||||
let cargo_spec = match CargoTargetSpec::for_file(&snap, file_id)? {
|
||||
|
@ -1844,7 +1844,7 @@ pub(crate) fn handle_move_item(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_ext::MoveItemParams,
|
||||
) -> anyhow::Result<Vec<lsp_ext::SnippetTextEdit>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_move_item").entered();
|
||||
let _p = tracing::info_span!("handle_move_item").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let range = from_proto::file_range(&snap, ¶ms.text_document, params.range)?;
|
||||
|
||||
|
@ -1866,7 +1866,7 @@ pub(crate) fn handle_view_recursive_memory_layout(
|
|||
snap: GlobalStateSnapshot,
|
||||
params: lsp_types::TextDocumentPositionParams,
|
||||
) -> anyhow::Result<Option<lsp_ext::RecursiveMemoryLayout>> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "handle_view_recursive_memory_layout").entered();
|
||||
let _p = tracing::info_span!("handle_view_recursive_memory_layout").entered();
|
||||
let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?;
|
||||
let line_index = snap.file_line_index(file_id)?;
|
||||
let offset = from_proto::offset(&line_index, params.position)?;
|
||||
|
|
|
@ -175,7 +175,7 @@ fn integrated_completion_benchmark() {
|
|||
};
|
||||
|
||||
{
|
||||
let _p = tracing::span!(tracing::Level::INFO, "unqualified path completion").entered();
|
||||
let _p = tracing::info_span!("unqualified path completion").entered();
|
||||
let _span = profile::cpu_span();
|
||||
let analysis = host.analysis();
|
||||
let config = CompletionConfig {
|
||||
|
@ -218,7 +218,7 @@ fn integrated_completion_benchmark() {
|
|||
};
|
||||
|
||||
{
|
||||
let _p = tracing::span!(tracing::Level::INFO, "dot completion").entered();
|
||||
let _p = tracing::info_span!("dot completion").entered();
|
||||
let _span = profile::cpu_span();
|
||||
let analysis = host.analysis();
|
||||
let config = CompletionConfig {
|
||||
|
@ -316,7 +316,7 @@ fn integrated_diagnostics_benchmark() {
|
|||
};
|
||||
|
||||
{
|
||||
let _p = tracing::span!(tracing::Level::INFO, "diagnostics").entered();
|
||||
let _p = tracing::info_span!("diagnostics").entered();
|
||||
let _span = profile::cpu_span();
|
||||
host.analysis()
|
||||
.diagnostics(&diagnostics_config, ide::AssistResolveStrategy::None, file_id)
|
||||
|
|
|
@ -230,7 +230,7 @@ impl GlobalState {
|
|||
fn handle_event(&mut self, event: Event) -> anyhow::Result<()> {
|
||||
let loop_start = Instant::now();
|
||||
// NOTE: don't count blocking select! call as a loop-turn time
|
||||
let _p = tracing::span!(Level::INFO, "GlobalState::handle_event", event = %event).entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event", event = %event).entered();
|
||||
|
||||
let event_dbg_msg = format!("{event:?}");
|
||||
tracing::debug!(?loop_start, ?event, "handle_event");
|
||||
|
@ -249,9 +249,7 @@ impl GlobalState {
|
|||
lsp_server::Message::Response(resp) => self.complete_request(resp),
|
||||
},
|
||||
Event::QueuedTask(task) => {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/queued_task")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event/queued_task").entered();
|
||||
self.handle_queued_task(task);
|
||||
// Coalesce multiple task events into one loop turn
|
||||
while let Ok(task) = self.deferred_task_queue.receiver.try_recv() {
|
||||
|
@ -259,8 +257,7 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
Event::Task(task) => {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/task")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event/task").entered();
|
||||
let mut prime_caches_progress = Vec::new();
|
||||
|
||||
self.handle_task(&mut prime_caches_progress, task);
|
||||
|
@ -314,8 +311,7 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
Event::Vfs(message) => {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/vfs").entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event/vfs").entered();
|
||||
self.handle_vfs_msg(message);
|
||||
// Coalesce many VFS event into a single loop turn
|
||||
while let Ok(message) = self.loader.receiver.try_recv() {
|
||||
|
@ -323,8 +319,7 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
Event::Flycheck(message) => {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/flycheck")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event/flycheck").entered();
|
||||
self.handle_flycheck_msg(message);
|
||||
// Coalesce many flycheck updates into a single loop turn
|
||||
while let Ok(message) = self.flycheck_receiver.try_recv() {
|
||||
|
@ -332,9 +327,7 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
Event::TestResult(message) => {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "GlobalState::handle_event/test_result")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_event/test_result").entered();
|
||||
self.handle_cargo_test_msg(message);
|
||||
// Coalesce many test result event into a single loop turn
|
||||
while let Ok(message) = self.test_run_receiver.try_recv() {
|
||||
|
@ -669,12 +662,11 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
fn handle_vfs_msg(&mut self, message: vfs::loader::Message) {
|
||||
let _p = tracing::span!(Level::INFO, "GlobalState::handle_vfs_msg").entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_vfs_msg").entered();
|
||||
let is_changed = matches!(message, vfs::loader::Message::Changed { .. });
|
||||
match message {
|
||||
vfs::loader::Message::Changed { files } | vfs::loader::Message::Loaded { files } => {
|
||||
let _p = tracing::span!(Level::INFO, "GlobalState::handle_vfs_msg{changed/load}")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_vfs_msg{changed/load}").entered();
|
||||
let vfs = &mut self.vfs.write().0;
|
||||
for (path, contents) in files {
|
||||
let path = VfsPath::from(path);
|
||||
|
@ -688,8 +680,7 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
vfs::loader::Message::Progress { n_total, n_done, dir, config_version } => {
|
||||
let _p =
|
||||
tracing::span!(Level::INFO, "GlobalState::handle_vfs_mgs/progress").entered();
|
||||
let _p = tracing::info_span!("GlobalState::handle_vfs_mgs/progress").entered();
|
||||
always!(config_version <= self.vfs_config_version);
|
||||
|
||||
let state = match n_done {
|
||||
|
@ -731,8 +722,7 @@ impl GlobalState {
|
|||
let snap = self.snapshot();
|
||||
|
||||
self.task_pool.handle.spawn_with_sender(ThreadIntent::Worker, move |sender| {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "GlobalState::check_if_indexed")
|
||||
.entered();
|
||||
let _p = tracing::info_span!("GlobalState::check_if_indexed").entered();
|
||||
tracing::debug!(?uri, "handling uri");
|
||||
let id = from_proto::file_id(&snap, &uri).expect("unable to get FileId");
|
||||
if let Ok(crates) = &snap.analysis.crates_for(id) {
|
||||
|
|
|
@ -70,8 +70,7 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
pub(crate) fn update_configuration(&mut self, config: Config) {
|
||||
let _p =
|
||||
tracing::span!(tracing::Level::INFO, "GlobalState::update_configuration").entered();
|
||||
let _p = tracing::info_span!("GlobalState::update_configuration").entered();
|
||||
let old_config = mem::replace(&mut self.config, Arc::new(config));
|
||||
if self.config.lru_parse_query_capacity() != old_config.lru_parse_query_capacity() {
|
||||
self.analysis_host.update_lru_capacity(self.config.lru_parse_query_capacity());
|
||||
|
@ -372,7 +371,7 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
pub(crate) fn switch_workspaces(&mut self, cause: Cause) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "GlobalState::switch_workspaces").entered();
|
||||
let _p = tracing::info_span!("GlobalState::switch_workspaces").entered();
|
||||
tracing::info!(%cause, "will switch workspaces");
|
||||
|
||||
let Some((workspaces, force_reload_crate_graph)) =
|
||||
|
@ -660,7 +659,7 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
fn reload_flycheck(&mut self) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "GlobalState::reload_flycheck").entered();
|
||||
let _p = tracing::info_span!("GlobalState::reload_flycheck").entered();
|
||||
let config = self.config.flycheck();
|
||||
let sender = self.flycheck_sender.clone();
|
||||
let invocation_strategy = match config {
|
||||
|
|
|
@ -238,7 +238,7 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
|
|||
let tracing = if let QueryStorage::Memoized = query.storage {
|
||||
let s = format!("{trait_name}::{fn_name}");
|
||||
Some(quote! {
|
||||
let _p = tracing::span!(tracing::Level::DEBUG, #s, #(#key_names = tracing::field::debug(&#key_names)),*).entered();
|
||||
let _p = tracing::debug_span!(#s, #(#key_names = tracing::field::debug(&#key_names)),*).entered();
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -120,7 +120,7 @@ pub struct TreeDiff {
|
|||
|
||||
impl TreeDiff {
|
||||
pub fn into_text_edit(&self, builder: &mut TextEditBuilder) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "into_text_edit").entered();
|
||||
let _p = tracing::info_span!("into_text_edit").entered();
|
||||
|
||||
for (anchor, to) in &self.insertions {
|
||||
let offset = match anchor {
|
||||
|
@ -149,7 +149,7 @@ impl TreeDiff {
|
|||
///
|
||||
/// This function tries to find a fine-grained diff.
|
||||
pub fn diff(from: &SyntaxNode, to: &SyntaxNode) -> TreeDiff {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "diff").entered();
|
||||
let _p = tracing::info_span!("diff").entered();
|
||||
|
||||
let mut diff = TreeDiff {
|
||||
replacements: FxHashMap::default(),
|
||||
|
|
|
@ -185,7 +185,7 @@ impl ast::Expr {
|
|||
/// ast::Expr::parse("let fail = true;", Edition::CURRENT).tree();
|
||||
/// ```
|
||||
pub fn parse(text: &str, edition: Edition) -> Parse<ast::Expr> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "Expr::parse").entered();
|
||||
let _p = tracing::info_span!("Expr::parse").entered();
|
||||
let (green, errors) = parsing::parse_text_at(text, parser::TopEntryPoint::Expr, edition);
|
||||
let root = SyntaxNode::new_root(green.clone());
|
||||
|
||||
|
@ -203,7 +203,7 @@ pub use crate::ast::SourceFile;
|
|||
|
||||
impl SourceFile {
|
||||
pub fn parse(text: &str, edition: Edition) -> Parse<SourceFile> {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
|
||||
let _p = tracing::info_span!("SourceFile::parse").entered();
|
||||
let (green, errors) = parsing::parse_text(text, edition);
|
||||
let root = SyntaxNode::new_root(green.clone());
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::{syntax_node::GreenNode, SyntaxError, SyntaxTreeBuilder};
|
|||
pub(crate) use crate::parsing::reparsing::incremental_reparse;
|
||||
|
||||
pub(crate) fn parse_text(text: &str, edition: parser::Edition) -> (GreenNode, Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse_text").entered();
|
||||
let _p = tracing::info_span!("parse_text").entered();
|
||||
let lexed = parser::LexedStr::new(text);
|
||||
let parser_input = lexed.to_input();
|
||||
let parser_output = parser::TopEntryPoint::SourceFile.parse(&parser_input, edition);
|
||||
|
@ -23,7 +23,7 @@ pub(crate) fn parse_text_at(
|
|||
entry: parser::TopEntryPoint,
|
||||
edition: parser::Edition,
|
||||
) -> (GreenNode, Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parse_text_at").entered();
|
||||
let _p = tracing::info_span!("parse_text_at").entered();
|
||||
let lexed = parser::LexedStr::new(text);
|
||||
let parser_input = lexed.to_input();
|
||||
let parser_output = entry.parse(&parser_input, edition);
|
||||
|
@ -35,7 +35,7 @@ pub(crate) fn build_tree(
|
|||
lexed: parser::LexedStr<'_>,
|
||||
parser_output: parser::Output,
|
||||
) -> (GreenNode, Vec<SyntaxError>, bool) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "build_tree").entered();
|
||||
let _p = tracing::info_span!("build_tree").entered();
|
||||
let mut builder = SyntaxTreeBuilder::default();
|
||||
|
||||
let is_eof = lexed.intersperse_trivia(&parser_output, &mut |step| match step {
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub(crate) fn validate(root: &SyntaxNode, errors: &mut Vec<SyntaxError>) {
|
||||
let _p = tracing::span!(tracing::Level::INFO, "parser::validate").entered();
|
||||
let _p = tracing::info_span!("parser::validate").entered();
|
||||
// FIXME:
|
||||
// * Add unescape validation of raw string literals and raw byte string literals
|
||||
// * Add validation of doc comments are being attached to nodes
|
||||
|
|
Loading…
Reference in a new issue