Skip to main content

Session

Struct Session 

Source
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

Source

pub fn new(entry: Option<&str>) -> Session

Source

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

Source

pub fn entry_abs(&self) -> PathBuf

Source

pub fn entry_name(&self) -> String

Source

pub fn apply(&mut self, op: Op) -> SResult<()>

Source

pub fn undo(&mut self, n: usize) -> usize

Source

pub fn redo(&mut self, n: usize) -> usize

Source

pub fn reload_op(&self) -> Op

Source

pub fn run(&self, mode: Mode) -> Run

load, check, and (unless mode says otherwise) evaluate the state

Source

pub fn evaluate_expr(&self, text: &str) -> SResult<ExprResult>

partial evaluation of one expression (§2.1)

Source

pub fn roots(&self) -> Vec<RootInfo>

the roots of the universe and of the session (:roots)

Source

pub fn all_root_names(&self) -> Vec<String>

Source

pub fn has_root(&self, name: &str) -> bool

Source

pub fn check(&self) -> Vec<(String, Diag)>

static diagnostics of every module, with the file each is reported against

Source

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

Source

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

Source

pub fn type_of(&self, text: &str) -> SResult<(String, bool, Vec<Diag>)>

the static type of an expression (:type)

Source

pub fn path_of(&self, text: &str) -> SResult<String>

the canonical path of the place a navigation names (:path)

Source

pub fn doc_of(&self, name: &str) -> SResult<Vec<String>>

the declaration a name resolves to, with its documentation (:doc)

Source

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)

Source

pub fn complete(&self, text: &str, commands: &[&str]) -> Vec<String>

the candidates completion offers at the end of text (:complete)

Source

pub fn scratch_text(&self) -> String

Source

pub fn module_text(&self) -> String

the scratch module as a file: imports of the entry’s exports it uses, then the declarations

Source

pub fn fmt(&self) -> SResult<String>

Source

pub fn write(&self, file: &str) -> SResult<()>

Source

pub fn document_text(&self, name: &str) -> SResult<String>

Source

pub fn save(&self, name: &str, file: &str) -> SResult<()>

Source

pub fn diff(&self, name: &str) -> SResult<Vec<String>>

Source

pub fn session_lines(&self) -> Vec<String>

Source

pub fn history_lines(&self) -> Vec<String>

Source

pub fn script_lines(&self) -> Vec<String>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.