LuaLS / LuaLS/lua-language-server

Parser gets confused by stray commas

Đang mở
#2,564 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.

Ngôn ngữ chính
Lua
Star
4.4k
Fork
442
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Example:

L.FOO = "something",
L.BAR = "something else"

This triggers two unexpected diagnostics: err-equal-as-assign and redundant-value which is a bit confusing.

The reason is that it interprets this as that the user's intent was to write FOO, (some other var) = "something", BAR == "something else"

However, the actual error is a stray comma after the first line.

This error may sound a bit obscure, because why would add someone a stray comma? The answer is that this happened in a localization files where people who are not necessarily familiar with Lua are contributing translations. Sometimes these translations are given in table literals where they need to add commas after each line and sometimes they are given as a list of setfield statements...

This is probably not easy to fix because the parser's interpretation is completely valid until it encounteres the assignment...

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.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ví dụ Lua với hai dòng phép gán và kiểm tra đường dẫn parser tạo ra err-equal-as-assign và redundant-value. Vấn đề được giải quyết khi dấu phẩy thừa được báo cáo là lỗi liên quan, thay vì tạo ra những chẩn đoán gây khó hiểu đó.

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

Đánh giá

Công nghệ
lua
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.