MCPcopy Create free account
hub / github.com/Eeive/Evcode-ide / from_path

Method from_path

src/editor/mod.rs:45–57  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

43}
44
45 pub fn from_path(path: &str) -> Result<Self> {
46 let content = std::fs::read_to_string(path)
47 .with_context(|| format!("Failed to read file: {path}"))?;
48 let lang = Lang::from_path(path);
49 Ok(Self {
50 path: Some(path.to_string()),
51 buffer: EditorBuffer::from_str(&content),
52 modified: false,
53 lsp_version: 1,
54 lang,
55 scroll_top: 0,
56 })
57 }
58
59 pub fn save(&mut self) -> Result<()> {
60 let path = self

Callers

nothing calls this directly

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected