mirror of https://github.com/lapce/lapce.git
Remove load_rope
This commit is contained in:
parent
baa0e63bd0
commit
f195f25eed
|
@ -23,11 +23,7 @@ pub struct Buffer {
|
||||||
|
|
||||||
impl Buffer {
|
impl Buffer {
|
||||||
pub fn new(id: BufferId, path: PathBuf) -> Buffer {
|
pub fn new(id: BufferId, path: PathBuf) -> Buffer {
|
||||||
let rope = if let Ok(rope) = load_rope(&path) {
|
let rope = Rope::from(load_file(&path).unwrap_or_default());
|
||||||
rope
|
|
||||||
} else {
|
|
||||||
Rope::from("")
|
|
||||||
};
|
|
||||||
let rev = if rope.is_empty() { 0 } else { 1 };
|
let rev = if rope.is_empty() { 0 } else { 1 };
|
||||||
let language_id = language_id_from_path(&path).unwrap_or("");
|
let language_id = language_id_from_path(&path).unwrap_or("");
|
||||||
let mod_time = get_mod_time(&path);
|
let mod_time = get_mod_time(&path);
|
||||||
|
@ -149,10 +145,6 @@ pub fn load_file(path: &Path) -> Result<String> {
|
||||||
Ok(read_path_to_string_lossy(path)?)
|
Ok(read_path_to_string_lossy(path)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_rope(path: &Path) -> Result<Rope> {
|
|
||||||
Ok(Rope::from(read_path_to_string_lossy(path)?))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn read_path_to_string_lossy<P: AsRef<Path>>(
|
pub fn read_path_to_string_lossy<P: AsRef<Path>>(
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<String, std::io::Error> {
|
) -> Result<String, std::io::Error> {
|
||||||
|
|
Loading…
Reference in New Issue