-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Description
- rust.vim version: current
Steps to reproduce:
- have MS PowerShell as the shell in which vim runs (e.g.
$Env:ComSpec=C:\WINDOWS\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
)
" in .vimrc
" Set Powershell as the shell of choice
let &shell = has('win32') ? 'powershell' : 'pwsh'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote=\" shellxquote=
set noshelltemp
- have a rust project with a workspace
- edit a file inside the workspace (e.g. a
.rs
file inside the embedded library) so thatsyntax-checkers/rust/cargo.vim
would have to enter this fork of thecargo.vim
script - save the
.rs
source file so that rust syntax-checker runs
Expected vs. actual behavior:
- This happens because PowerShell does not chain commands with
&&
like other shells, so it errors out at(cd <path> && cargo check)
Expected:
- Chain commands with
;
if Powershell is used. - I corrected it for myself like this (replaced
&&
with) ; (
) in here:
if rust#GetConfigVar('rust_cargo_avoid_whole_workspace', 1)
if l:root_cargo_toml !=# l:nearest_cargo_toml
let makeprg = "cd " . fnamemodify(l:nearest_cargo_toml, ":p:h")
\ . ") ; (" . makeprg
endif
else
let makeprg = "cd " . fnamemodify(l:root_cargo_toml, ":p:h")
\ . ") ; (" . makeprg
endif
- a mere
;
is not enough because then you'd end one powershell command without closing the parenthesis. - The script needs some logic to do this type of command chaining only when PowerShell is used as shell.
Metadata
Metadata
Assignees
Labels
No labels