Skip to content

Commit

Permalink
fix(runnables): cd into directory with spaces not working (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Feb 6, 2024
1 parent 18b5442 commit b42e081
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
with:
test_interpreters: ""
detailed_description: |
This plugin automatically configures the rust-analyzer builtin LSP client
and integrates with other Rust tools. See the README's #features section
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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.5.2] - 2024-02-06

- runnables/debuggables/testables: `cd` into directory with spaces [[#212](https://github.com/mrcjkb/rustaceanvim/issues/212)].

### Fixed

## [4.5.1] - 2024-02-03

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ M.system = vim.system
if opts and opts.cwd then
local shell = require('rustaceanvim.shell')
---@diagnostic disable-next-line: undefined-field
cmd = shell.chain_commands { 'cd ' .. opts.cwd, table.concat(cmd, ' ') }
cmd = shell.chain_commands { shell.make_cd_command(opts.cwd), table.concat(cmd, ' ') }
---@cast cmd string
end

Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/executors/termopen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local M = {
local ui = require('rustaceanvim.ui')
local commands = {}
if cwd then
table.insert(commands, shell.make_command_from_args('cd', { cwd }))
table.insert(commands, shell.make_cd_command(cwd))
end
table.insert(commands, shell.make_command_from_args(command, args))
local full_command = shell.chain_commands(commands)
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/executors/vimux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local M = {
execute_command = function(command, args, cwd, _)
local commands = {}
if cwd then
table.insert(commands, shell.make_command_from_args('cd', { cwd }))
table.insert(commands, shell.make_cd_command(cwd))
end
table.insert(commands, shell.make_command_from_args(command, args))
local full_command = shell.chain_commands(commands)
Expand Down
7 changes: 7 additions & 0 deletions lua/rustaceanvim/shell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ function M.chain_commands(commands)
return ret
end

---Create a `cd` command for the path
---@param path string
---@return string
function M.make_cd_command(path)
return ('cd "%s"'):format(path)
end

---@param command string
---@param args string[]
---@return string command
Expand Down

0 comments on commit b42e081

Please sign in to comment.