Fix bug in LSP when creating a file in a folder that does not exist (#1775)
This commit is contained in:
parent
194b09fbc1
commit
bfa533fe78
1 changed files with 7 additions and 0 deletions
|
@ -286,6 +286,13 @@ pub fn apply_document_resource_op(op: &lsp::ResourceOp) -> std::io::Result<()> {
|
|||
if ignore_if_exists && path.exists() {
|
||||
Ok(())
|
||||
} 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, [])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue