"if" in comment can mess up indentaction

Đang mở
#479 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust, vim
Lĩnh vực
tooling

Hướng nghiên cứu

Start with the referenced logic in indent/rust.vim at lines 148–149 and check how it handles the example comment before a struct block. Reproduce the indentation issue with the supplied steps, then confirm that the closing brace is no longer indented by the comment. No test file is mentioned in the issue.

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

Mô tả

  • rust.vim version: 4aa69b84c8a58fcec6b6dad6fe244b916b1cf830

Steps to reproduce:

  • Edit a file with "If" inside a comment, on an indented line (I believe "fn" will also trigger the issue)
  • Begin and end any block

Expected behavior: The comment shouldn't affect indenting
Actual behavior: The } char will be indented to match the indent of the comment line. Note the leading space in the example below:

/**
 * Something is wrong if rust.vim adds indent to the last line
 */

struct Foo {
 }

I believe this is due to this line, which doesn't take into account if a line is a comment or not: https://github.com/rust-lang/rust.vim/blob/master/indent/rust.vim#L148-L149

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.