pub struct Session {
pub entry_path: Option<PathBuf>,
pub log: Vec<Op>,
pub cursor: usize,
pub last_timing: Cell<Option<Timing>>,
pub overlay: HashMap<PathBuf, String>,
/* private fields */
}Fields§
§entry_path: Option<PathBuf>§log: Vec<Op>§cursor: usize§last_timing: Cell<Option<Timing>>§overlay: HashMap<PathBuf, String>texts that override the disk (the language server’s open buffers), by absolute path
Implementations§
Source§impl Session
impl Session
pub fn new(entry: Option<&str>) -> Session
Sourcepub fn with_overlay(
entry: Option<&str>,
overlay: Option<&HashMap<PathBuf, String>>,
) -> Session
pub fn with_overlay( entry: Option<&str>, overlay: Option<&HashMap<PathBuf, String>>, ) -> Session
overlay: texts that override the disk (the language server’s open buffers), by absolute path
pub fn entry_abs(&self) -> PathBuf
pub fn entry_name(&self) -> String
pub fn apply(&mut self, op: Op) -> SResult<()>
pub fn undo(&mut self, n: usize) -> usize
pub fn redo(&mut self, n: usize) -> usize
pub fn reload_op(&self) -> Op
Sourcepub fn run(&self, mode: Mode) -> Run
pub fn run(&self, mode: Mode) -> Run
load, check, and (unless mode says otherwise) evaluate the state
Sourcepub fn evaluate_expr(&self, text: &str) -> SResult<ExprResult>
pub fn evaluate_expr(&self, text: &str) -> SResult<ExprResult>
partial evaluation of one expression (§2.1)
pub fn all_root_names(&self) -> Vec<String>
pub fn has_root(&self, name: &str) -> bool
Sourcepub fn check(&self) -> Vec<(String, Diag)>
pub fn check(&self) -> Vec<(String, Diag)>
static diagnostics of every module, with the file each is reported against
Sourcepub fn evaluate(
&self,
names: &[String],
) -> SResult<(Run, Vec<(String, Option<String>)>, bool)>
pub fn evaluate( &self, names: &[String], ) -> SResult<(Run, Vec<(String, Option<String>)>, bool)>
full evaluation of the named roots (:evaluate), or of the exported outputs
Sourcepub fn validate(
&self,
names: &[String],
) -> SResult<(Run, Vec<(String, usize, usize)>, Vec<Diag>)>
pub fn validate( &self, names: &[String], ) -> SResult<(Run, Vec<(String, usize, usize)>, Vec<Diag>)>
whole-document validation of the named roots (:validate), or of every root
Sourcepub fn type_of(&self, text: &str) -> SResult<(String, bool, Vec<Diag>)>
pub fn type_of(&self, text: &str) -> SResult<(String, bool, Vec<Diag>)>
the static type of an expression (:type)
Sourcepub fn path_of(&self, text: &str) -> SResult<String>
pub fn path_of(&self, text: &str) -> SResult<String>
the canonical path of the place a navigation names (:path)
Sourcepub fn doc_of(&self, name: &str) -> SResult<Vec<String>>
pub fn doc_of(&self, name: &str) -> SResult<Vec<String>>
the declaration a name resolves to, with its documentation (:doc)
Sourcepub fn trace(&self, path_text: &str) -> SResult<Vec<String>>
pub fn trace(&self, path_text: &str) -> SResult<Vec<String>>
the derivation of a valid place, or the root cause of an invalid one (:trace)
Sourcepub fn complete(&self, text: &str, commands: &[&str]) -> Vec<String>
pub fn complete(&self, text: &str, commands: &[&str]) -> Vec<String>
the candidates completion offers at the end of text (:complete)
pub fn scratch_text(&self) -> String
Sourcepub fn module_text(&self) -> String
pub fn module_text(&self) -> String
the scratch module as a file: imports of the entry’s exports it uses, then the declarations