Display richer error message

Đang mở
#403 1 bình luận 1 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
43/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust, vim

Hướng nghiên cứu

Start by locating rust.vim's makeprg and errorformat configuration, then check how its diagnostics are parsed. The report suggests using Cargo's human message format for richer multiline details, but leaves open whether to change the command format or parser. Done means location list entries show the useful diagnostic context from the example; test against the provided Cargo errors.

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

Mô tả

Tested with vim 8.2 and nvim 0.5.0-dev on fedora 30, with the current master of rust.vim (9e6836f44528312171b21a78d9228c88615f63ae) and the current master branch of syntastic (b3e2d8470fddc7f2b598f09023ebc5045a3fb1fd)

Steps to reproduce:

Type some rust code and wait for the error to be displayed in the location list (or open it manually with :lopen)

Currently the location list windows looks like this:

lib/dice_system.rs|34 col 5 error| struct is not supported in `trait`s or `impl`s                                                                                                                                                             
lib/dice_system.rs|41 col 5 error| associated type in `impl` without body
lib/dice_system.rs|41 col 23 error| bounds on `type`s in `impl`s have no effect
lib/dice_system.rs|53 col 5 error| associated function in `impl` without body
lib/dice_system.rs|54 col 5 error| associated function in `impl` without body

This is the same output that if you do manually (in command mode):

set makeprg=cargo\ check\ --message-format=short
make
copen

If I do change it to

set makeprg=cargo\ check\ --message-format=human

I get much nicer details

||     Checking pyrite v0.1.0 (/home/rmoussu/perso/brolisteam/pyrite)
lib/dice_system.rs|34 col 5 error| struct is not supported in `trait`s or `impl`s                                                                                                                                                             
||    |
|| 34 |     struct DiceInformation {
||    |     ^^^^^^^^^^^^^^^^^^^^^^
lib/dice_system.rs|41 col 5 error| associated type in `impl` without body
||    |
|| 41 |     type DiceDisplay: Display;
||    |     ^^^^^^^^^^^^^^^^^^^^^^^^^-
||    |                              |
||    |                              help: provide a definition for the type: `= <type>;`
lib/dice_system.rs|41 col 23 error| bounds on `type`s in `impl`s have no effect
||    |
|| 41 |     type DiceDisplay: Display;
||    |                       ^^^^^^^

I didn't found a way to specify the --message-format used by rust.vim It is possible? I am willing to do a PR, but I don't know where to look. I can also modify the errorformat used by rust.vim to correctly parse the multiline error but I don't know either where to look.

Using rust.vim + syntastic is much nicer that calling :make by hand since you have instant feedback, and it also works even if you have autochdir set.

I assume it's not possible to add colors (I don't think it's possible to display ANSI colors in vim – I have no idea if it's possible for neovim). If it was possible, then ideally --message-format=json-diagnostic-rendered-ansi should be used.

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.