Skip to content

Commit

Permalink
fix(rustc): windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jul 29, 2024
1 parent 58be8a9 commit 029ae8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Neotest: One test failure caused all succeeding tests to be marked as failed
when using cargo-nextest 0.9.7 [[#460](https://github.com/mrcjkb/rustaceanvim/issues/460)].
- Neotest: Disable ansi colour coding in output to ensure output can be parsed.
- `Rustc unpretty`: Support Windows.

## [5.1.0] - 2024-07-27

Expand Down
8 changes: 7 additions & 1 deletion lua/rustaceanvim/commands/rustc_unpretty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ local function handler(sc)
vim.api.nvim_buf_set_lines(latest_buf_id, 0, 0, false, lines)
end

---@return boolean
local function has_tree_sitter_rust()
return #api.nvim_get_runtime_file('parser/rust.so', true) > 0
or require('rustaceanvim.shell').is_windows() and #api.nvim_get_runtime_file('parser/rust.dll', true) > 0
end

---@param level rustaceanvim.rustcir.level
function M.rustc_unpretty(level)
if #api.nvim_get_runtime_file('parser/rust.so', true) == 0 then
if not has_tree_sitter_rust() then
vim.notify("a treesitter parser for Rust is required for 'rustc unpretty'", vim.log.levels.ERROR)
return
end
Expand Down

0 comments on commit 029ae8e

Please sign in to comment.