From 40053580acf52bbf10325c13088976cf41084c00 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 23 May 2024 20:36:50 +0200 Subject: [PATCH] fix(lsp): error when opening a rust file that does not exist Fixes #404. --- CHANGELOG.md | 7 +++++++ lua/rustaceanvim/cargo.lua | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7485835a..a3b9b1cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.23.4] - 2024-05-23 + +### Fixed + +- LSP: Error when editing a rust file in a directory + that does not exist [(#404)](https://github.com/mrcjkb/rustaceanvim/issues/404). + ## [4.23.3] - 2024-05-23 ### Fixed diff --git a/lua/rustaceanvim/cargo.lua b/lua/rustaceanvim/cargo.lua index c97d9177..f8ef7130 100644 --- a/lua/rustaceanvim/cargo.lua +++ b/lua/rustaceanvim/cargo.lua @@ -56,7 +56,7 @@ function cargo.get_root_dir(file_name) cargo_metadata = table.concat(d, '\n') end, stdout_buffered = true, - cwd = path, + cwd = compat.uv.fs_stat(path) and path or cargo_crate_dir or vim.fn.getcwd(), }) if cm > 0 then cm = vim.fn.jobwait({ cm })[1]