diff options
-rw-r--r-- | helix-term/src/commands/lsp.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index aa7fa1c8..308ff829 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -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, []) } } |