Include Comment Style in LineComment and BlockComment Nodes

Đang mở
#2,003 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/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ệ
javascript, typescript
Lĩnh vực
compilers, documentation

Hướng nghiên cứu

Bắt đầu với phần Comment được liên kết trong tài liệu API của Esprima và theo dõi cách parser biểu diễn các node LineComment và BlockComment. Xác nhận các giá trị style được đề xuất và cập nhật tài liệu cũng như hành vi AST liên quan để các node comment cung cấp style mà không xóa các thuộc tính hiện có.

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

Mô tả

Multiple different Javascript snippets can result in a LineComment node:

// type1
<!-- type2
--> type3

From current Esprima's output there's no way to know which one of these 'styles' was used as a comment.

Since this is specific to LineComment nodes, it's possible to split the type of node from 'LineComment' into 3 node types (one for each style). But I assume that would completely break the API. I offer the solution of adding 'style' attribute to Comment nodes (both Block and Line). The values can be: ['//', '', '/*'].

I believe this API change is relatively minor since we're only adding an attribute without replacing any existing ones. We will have to change the Comment section in the Esprima API documentation. There shouldn't be any performance degradation since the comment style is known while parsing, it just wasn't exposed to the AST.

Ngôn ngữ chính
TypeScript
Star
7.1k
Fork
772
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

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 jquery/esprima

Tất cả issue của jquery/esprima

Issue tương tự

Thêm issue về TypeScript

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.