Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add a mode which preserves carriage returns

Đang mở
#2 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/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ệ
kotlin
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách các tệp .ss và định dạng .ss.asar được tải, phân tích và ghi, bao gồm cả việc chuẩn hóa ký tự xuống dòng được mô tả ở đây. Xác định hành vi của mode về việc giữ lại \r và round-trip các tệp mà không thay đổi các quy tắc escaping khác; hoàn thành khi các snapshot .ss.asar giữ lại ký tự xuống dòng, trong khi các snapshot thông thường vẫn giữ hành vi hiện tại.

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

Mô tả

enhancement

Here are two important properties of the .ss snapshot files:

  • exactly character-for-character accurate, no slop around leading or trailing whitespace, no forbidden characters
  • what you see in the snapshot file is exactly what you get, except for the following escaping rules which preserve the above
    • the following characters are escaped: 𐝃 -> 𐝃𐝃, 𐝁 -> 𐝃𐝁 (they are from an untranslated dead language)
    • if the first character on a line within a snapshot is ╔ then it is replaced with 𐝁 (this preserves ASCII art within snapshots)

This combination of character-accurate + WYSIWYG breaks down in only one place - line endings. You can't see them, and git's complex and poorly understood line-ending-mutation rules mean that most teams can't reliably do source control that differentiates between \n and \r\n.

Rather than randomly punch users in the face with this triviality, we do the following:

  • Internally, every text-based snapshot in spotless-snapshot has a .replace("\r", ""), so snapshots will never fail because of line-ending differences
  • New .ss files are always written using \n line endings
  • If an .ss file is loaded from disk with \r\n, it is converted and parsed using \n, but will be written back to disk as \r\n

However, this means that the snapshots are not exactly character-for-character accurate because they do not preserve \r. For users that want to preserve \r, we could add a mode which preserves the \r character if the user uses the .ss.asar format

  • #1

Adding support for storing \r within .ss files might be possible (maybe encode them as 𐝃r?), but doesn't seem like a good idea.

Ngôn ngữ chính
Kotlin
Star
101
Fork
18
Merge trung bình
6 ngày 11 giờ
Pull request đã merge (30 ngày)
5

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 diffplug/selfie

Tất cả issue của diffplug/selfie

Issue tương tự

Thêm issue về Kotlin

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.