Perhaps trailing commas should be enabled by default

Đang mở
#103 2 bình luận 8 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
Sôi nổi
Công nghệ
typescript
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu với giá trị mặc định của tùy chọn parser trong src/impl/parser.ts tại vị trí được liên kết, sau đó kiểm tra cách dấu phẩy ở cuối được bao phủ ở những nơi khác trong repository. Xác định xem việc bật chúng theo mặc định có giữ nguyên hành vi opt-out hay không, rồi cập nhật các bài kiểm thử parser liên quan để xác nhận cả hai giá trị mặc định.

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

Mô tả

For any use of JSONC that is user-facing in VS code, for example in a .jsonc file saved by the user, or even the user settings JSONC file, trailing commas don't trigger an error:

  1. User config example:

    Image
  2. Standalone .jsonc file example:

    Image
  3. Only in .json is it shown as an error:

    Image

Visual Studio Code's own uses of JSONC seem for uses where trailing commas are desired, like the user config. An intended strength of the JSONC format seems to be easy user editing and writing. For "strict" uses of automatically generated files where the syntax is meant to stay super correct, there's still JSON as there always was as the more common choice.

Based on this, I would suggest that perhaps trailing commas should be enabled in the parser by default, so that e.g. parsing the VS Code config in JSONC works without manual changes.

I'm sure some will disagree, but the option to turn it off would remain in any case.

(Please note I'm not suggesting to remove the warning in the VS Code UI about trailing commas as discussed here, since I realize other JSONC parsers might still treat this differently.)

Ngôn ngữ chính
TypeScript
Star
759
Fork
66
Merge trung bình
5 ngày 10 giờ
Pull request đã merge (30 ngày)
7

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 microsoft/node-jsonc-parser

Tất cả issue của microsoft/node-jsonc-parser

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.