Blank line preservation
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
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Không có tệp, bài kiểm thử hay điểm vào nào được nêu tên; hãy bắt đầu bằng cách xác định các API stringification của node và di chuyển mã. Xác định và kiểm thử cách spaceBefore và spaceAfter biểu diễn các dòng trống, chú thích, ký tự xuống dòng ở đầu dòng và thụt lề, đồng thời quyết định liệu toString(true) có bao gồm chúng hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When moving a block of code, you can use toString on each node and "paste" the result by using the appropriate method. There needs to be a way to preserve blank lines between nodes, so we can preserve the author's style.
The first idea that comes to mind is a method that returns a string containing only newlines (and maybe indentation?) corresponding to the number of blank lines before or after the node (so two variants). This string can then be "pasted" just like the toString result.
As an example:
foo()
// comment 1
bar()
// comment 2
foo()
Assume the bar() expression is represented by node:
node.spaceBefore() // => "\n\n// comment 1\n"
node.toString() // => "bar()"
node.spaceAfter() // => "\n\n\n// comment 2\n"
In the above example, the \n that begins bar()'s line is included in the spaceBefore result. And the \n that begins the line after that is included in the spaceAfter result. I'm not certain, but I think that's the expected behavior.
I'm also undecided if indentation should be included or not. I'm leaning towards no, because toString currently strips indentation and we should match that behavior.
Another thing: maybe toString(true) can include the result of spaceAfter (and even the result of spaceBefore if we're the first sibling of a BlockStatement) to make things easier?
These decisions could easily be a source of many bugs if we aren't careful.
- Ngôn ngữ chính
- TypeScript
- Star
- 16
- Fork
- 1
- 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
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của alloc/nebu
-
Support input sourcemapsĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Conditional pluginsĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Support for other languagesĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
[RFC] Node.prototype.wrapĐang mởenhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Issue tương tự
-
ADD openalgoĐang mởtemplate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/ai#21528 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug Needs: Triage :mag:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/fluentui-contrib#671 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sveltejs/acorn-typescript#150 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100