Syntax checker does not work with workspaces in PowerShell

Đang mở
#495 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
vim
Lĩnh vực
tooling

Hướng nghiên cứu

Start with syntax_checkers/rust/cargo.vim, especially the workspace command construction around the lines linked in the issue, and inspect how the Vim shell setting identifies PowerShell. Reproduce the failure using the provided PowerShell configuration and a Rust workspace. Done when workspace syntax checking chains commands in a way PowerShell accepts while preserving the existing behavior for other shells.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • 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 that syntax-checkers/rust/cargo.vim would have to enter this fork of the cargo.vim script
  • save the .rs source file so that rust syntax-checker runs

Expected vs. actual behavior:

Actual:
2023-03-18 09_47_51-lib rs (C__Users_ssiegmun_src_serial2-updater_sulib_src) (3 of 6) - GVIM2

  • 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.
Ngôn ngữ chính
Vim Script
Star
4.2k
Fork
323
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rust-lang/rust.vim

Tất cả issue của rust-lang/rust.vim

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.