pub struct CompletionCtx<'a> {
pub source: Option<&'a str>,
pub position: Option<Position>,
pub doc_uri: Option<&'a Uri>,
pub file_imports: Option<&'a HashMap<String, String>>,
pub find_class_doc: Option<ClassDocLookup<'a>>,
pub workspace_class_search: Option<WorkspaceClassSearch<'a>>,
pub analysis: Option<&'a FileAnalysis>,
pub session: Option<&'a DocumentStore>,
pub laravel: Option<&'a LaravelIndex>,
}Expand description
Optional context for completion requests that enables richer results
(e.g. auto-import edits, -> scoping to a class).
Fields§
§source: Option<&'a str>§position: Option<Position>§doc_uri: Option<&'a Uri>§file_imports: Option<&'a HashMap<String, String>>§find_class_doc: Option<ClassDocLookup<'a>>Optional O(1) class-document lookup backed by the workspace index.
When Some, all_instance_members and all_static_members use it
to find the defining doc directly instead of scanning other_docs
linearly (O(n files × inheritance depth) → O(depth)).
Pass None to fall back to the existing linear scan.
workspace_class_search: Option<WorkspaceClassSearch<'a>>Optional workspace-wide class name search backed by the workspace
index (see WorkspaceClassSearch). Used to suggest — and
auto-import — classes from files that aren’t currently open, such as
vendor code. None in unit tests that don’t supply it.
analysis: Option<&'a FileAnalysis>Retained mir body analysis for the primary doc. Receiver-variable types
($obj->, match subjects) are read from its symbol_at; None in unit
tests that don’t supply it.
session: Option<&'a DocumentStore>Store handle for querying phpstorm-stubs member info on built-in PHP
classes via its mir-analyzer session. A handle rather than a borrowed
&mut AnalysisSession: find_class_doc (above) can itself lock the
session (DocumentStore::resolve_class_ref_by_fqn), and mir’s
session mutex isn’t reentrant, so nothing here may hold it across
that call — each session use below is its own short-lived lock.
None in unit tests that don’t require stubs.
laravel: Option<&'a LaravelIndex>Laravel string-key index (env/config/view/… — see
crate::laravel), for completion inside those helper calls’ string
arguments. None in unit tests that don’t supply it, and inert
(empty) for non-Laravel workspaces.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CompletionCtx<'a>
impl<'a> !Send for CompletionCtx<'a>
impl<'a> !Sync for CompletionCtx<'a>
impl<'a> !UnwindSafe for CompletionCtx<'a>
impl<'a> Freeze for CompletionCtx<'a>
impl<'a> Unpin for CompletionCtx<'a>
impl<'a> UnsafeUnpin for CompletionCtx<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more