Skip to main content

WorkspaceView

Trait WorkspaceView 

Source
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§

Source

fn module_exporting(&self, name: &str) -> Vec<ModuleExport>

Every module that publicly exports name (a function/type/variant).

Source

fn imports_of(&self, uri: &Url) -> Vec<String>

The module aliases the file at uri imports.

Source

fn module_names(&self) -> Vec<(String, Url)>

Every indexed module: its import alias and file Url.

Provided Methods§

Source

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).

Source

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.

Source

fn is_imported(&self, uri: &Url, name: &str) -> bool

Whether the file at uri imports a module that publicly exports name.

Implementors§