pub trait WorkspaceView {
// Required methods
fn module_exporting(&self, name: &str) -> Vec<ModuleExport>;
fn imports_of(&self, uri: &Url) -> Vec<String>;
fn module_names(&self) -> Vec<(String, Url)>;
// Provided methods
fn exports_of(&self, _uri: &Url) -> Vec<String> { ... }
fn imported_symbols(&self, uri: &Url) -> Vec<(String, String)> { ... }
fn is_imported(&self, uri: &Url, name: &str) -> bool { ... }
}Expand description
Read-only view of the workspace’s imports/exports, so LSP providers (auto-import, completion, hover) are unit-testable against a fake without a running server.
Required Methods§
Sourcefn module_exporting(&self, name: &str) -> Vec<ModuleExport>
fn module_exporting(&self, name: &str) -> Vec<ModuleExport>
Every module that publicly exports name (a function/type/variant).
Sourcefn imports_of(&self, uri: &Url) -> Vec<String>
fn imports_of(&self, uri: &Url) -> Vec<String>
The module aliases the file at uri imports.
Sourcefn module_names(&self) -> Vec<(String, Url)>
fn module_names(&self) -> Vec<(String, Url)>
Every indexed module: its import alias and file Url.
Provided Methods§
Sourcefn exports_of(&self, _uri: &Url) -> Vec<String>
fn exports_of(&self, _uri: &Url) -> Vec<String>
The public names the module at uri exports. Default empty (fakes that
don’t need it are unaffected).
Sourcefn imported_symbols(&self, uri: &Url) -> Vec<(String, String)>
fn imported_symbols(&self, uri: &Url) -> Vec<(String, String)>
The symbol labels to offer for this file’s imports (label, module alias).
Default: whole-module semantics (every export of every imported module) —
a fake that only implements imports_of/exports_of keeps its behavior.
The real index overrides this to honor selective imports.
Sourcefn is_imported(&self, uri: &Url, name: &str) -> bool
fn is_imported(&self, uri: &Url, name: &str) -> bool
Whether the file at uri imports a module that publicly exports name.