rust-lang / rust.vim

Vim configuration for Rust.
Apache License 2.0
3.89k stars 295 forks source link

When :Cbuild uses term, it doesn't update the quickfix list #404

Open joshtriplett opened 4 years ago

joshtriplett commented 4 years ago

Steps to reproduce:

Paste debugging info from the Rust Vim plugin via one of the following commands: :RustInfo, :RustInfoToClipboard, or :RustInfoToFile <filename>.

rust.vim Global Variables:

let g:ftplugin_rust_source_path = v:null
let g:loaded_syntastic_rust_cargo_checker = v:null
let g:loaded_syntastic_rust_filetype = v:null
let g:loaded_syntastic_rust_rustc_checker = v:null
let g:rust_bang_comment_leader = v:null
let g:rust_cargo_avoid_whole_workspace = v:null
let g:rust_clip_command = v:null
let g:rust_conceal = v:null
let g:rust_conceal_mod_path = v:null
let g:rust_conceal_pub = v:null
let g:rust_fold = v:null
let g:rust_last_args = v:null
let b:rust_last_args = []
let g:rust_last_rustc_args = v:null
let b:rust_last_rustc_args = []
let g:rust_original_delimitMate_excluded_regions = v:null
let g:rust_playpen_url = v:null
let g:rust_prev_delimitMate_quotes = v:null
let g:rust_recent_nearest_cargo_tol = v:null
let g:rust_recent_root_cargo_toml = v:null
let g:rust_recommended_style = v:null
let g:rust_set_conceallevel = v:null
let g:rust_set_conceallevel=1 = v:null
let g:rust_set_foldmethod = v:null
let g:rust_set_foldmethod=1 = v:null
let g:rust_shortener_url = v:null
let g:rustc_makeprg_no_percent = v:null
let g:rustc_path = v:null
let g:rustfmt_autosave = 0
let g:rustfmt_autosave_if_config_present = v:null
let g:rustfmt_command = 'rustfmt'
let g:rustfmt_emit_files = 1
let g:rustfmt_fail_silently = 0
let g:rustfmt_options = ''
let g:syntastic_extra_filetypes = ['rust']
let g:syntastic_rust_cargo_fname = v:null
rustfmt 1.4.12-stable (a828ffe 2020-03-11)

rustc 1.43.1 (8d69840ab 2020-05-04)

cargo 1.43.0 (2cbe9048e 2020-05-03)

NVIM v0.4.3
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-xAEA75/neovim-0.4.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=1 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim-xAEA75/neovim-0.4.3/build/config -I/build/neovim-xAEA75/neovim-0.4.3/src -I/usr/include -I/usr/include/lua5.1 -I/build/neovim-xAEA75/neovim-0.4.3/build/src/nvim/auto -I/build/neovim-xAEA75/neovim-0.4.3/build/include
Compiled by team+vim@tracker.debian.org

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
da-x commented 4 years ago

I think it never worked with Cbuild, even without terminal (i.e. let g:cargo_shell_command_runner = '!'). But if we want this for terminals, we would need to hack around execution of runtime compiler/cargo.vim | caddbuffer in the terminal buffer so that the terminal output is processed into quickfix with the proper errorformat. Maybe @rhysd got an idea?

An alternative is to use builtin supported :make build (with rust.vim make is wrapper for Cargo with quickfix parsing), or Syntastic, or the external ale.

joshtriplett commented 4 years ago

I'd love to have the terminal output processed for errors. On the fly would be nice, for long compiles, but even if I have to wait until the compile completes that would be better than nothing.

I'm aware of :make build, but that doesn't allow continuing to work while it runs; it also doesn't support color. I greatly prefer :Cbuild, except for the missing quickfix list.

Populating the quickfix output also keeps the output around after the build, which is useful for reviewing.

da-x commented 4 years ago

Perhaps there's even a wider need in Vim/NeoVim world to populate quickfix from terminal output, as further rationale to the reason terminal buffers exists in the first place. This should be either a plugin library or an editor feature that we could use. It's hard in a sense that it needs to work similarly in Vim and NeoVim, for which terminal API interfaces are different. Anyway, it's not quite simple, I'd need to do some research to find how to come up with this functionality.

maujim commented 3 years ago

@joshtriplett you can use :Make provided by https://github.com/tpope/vim-dispatch/.

It's a wrapper for :make that will populate the quickfix list upon completion. It's async so you can keep working while it runs.