mirror of https://github.com/helix-editor/helix
Fix bug in LSP when creating a file in a folder that does not exist (#1775)
parent
194b09fbc1
commit
bfa533fe78
|
@ -286,6 +286,13 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
|
||||||
if ignore_if_exists && path.exists() {
|
if ignore_if_exists && path.exists() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
// Create directory if it does not exist
|
||||||
|
if let Some(dir) = path.parent() {
|
||||||
|
if !dir.is_dir() {
|
||||||
|
fs::create_dir_all(&dir)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fs::write(&path, [])
|
fs::write(&path, [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue