Skip to content

Commit 029ae8e

Browse files
Marc Jakobimrcjkb
authored andcommitted
fix(rustc): windows support
1 parent 58be8a9 commit 029ae8e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Neotest: One test failure caused all succeeding tests to be marked as failed
1414
when using cargo-nextest 0.9.7 [[#460](https://github.com/mrcjkb/rustaceanvim/issues/460)].
1515
- Neotest: Disable ansi colour coding in output to ensure output can be parsed.
16+
- `Rustc unpretty`: Support Windows.
1617

1718
## [5.1.0] - 2024-07-27
1819

lua/rustaceanvim/commands/rustc_unpretty.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ local function handler(sc)
9292
vim.api.nvim_buf_set_lines(latest_buf_id, 0, 0, false, lines)
9393
end
9494

95+
---@return boolean
96+
local function has_tree_sitter_rust()
97+
return #api.nvim_get_runtime_file('parser/rust.so', true) > 0
98+
or require('rustaceanvim.shell').is_windows() and #api.nvim_get_runtime_file('parser/rust.dll', true) > 0
99+
end
100+
95101
---@param level rustaceanvim.rustcir.level
96102
function M.rustc_unpretty(level)
97-
if #api.nvim_get_runtime_file('parser/rust.so', true) == 0 then
103+
if not has_tree_sitter_rust() then
98104
vim.notify("a treesitter parser for Rust is required for 'rustc unpretty'", vim.log.levels.ERROR)
99105
return
100106
end

0 commit comments

Comments
 (0)