@@ -158,9 +158,12 @@ fn narrow_package_top_level(file: File, db: &dyn Db, package: Package) -> Vec<Im
158158}
159159
160160/// The file's `library()` / `require()` attaches as `Package` layers, in LIFO
161- /// order (latest-attached first). `before` narrows to a top-level cursor: with
162- /// `Some(offset)`, keep only file-scope calls that have run by `offset`; with
163- /// `None`, keep every attach (the end-of-file view, used for lazy contexts).
161+ /// order (latest-attached first). `before` selects which calls to include:
162+ ///
163+ /// - `None`: every attach. The end-of-file view, used for lazy contexts.
164+ /// - `Some(offset)`: only top-level (file-scope) calls that have run by
165+ /// `offset`. Calls nested in a block (e.g. inside `test_that({})`) are
166+ /// dropped, as are calls after the offset.
164167fn attach_layers ( file : File , db : & dyn Db , before : Option < TextSize > ) -> Vec < ImportLayer > {
165168 let index = file. semantic_index ( db) ;
166169 let file_scope = ScopeId :: from ( 0 ) ;
@@ -239,7 +242,7 @@ fn package_imports(file: File, db: &dyn Db, package: Package) -> Vec<ImportLayer
239242/// 6. base.
240243///
241244/// `offset` narrows the components of layer 4. `None` produces the end-of-file
242- /// view and keeps every `library()` call. `Some(offset)` keeps only the calls
245+ /// view and uses every `library()` call. `Some(offset)` uses only the calls
243246/// that have run by `offset`. The other layers are sourced or attached before
244247/// the file body runs, so they never narrow.
245248fn testthat_imports (
0 commit comments