diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index aa7fa1c87e0a..308ff82920c6 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, []) } }