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

LuaLS processes the wrong LuaDoc for Penlight tablex.filter

Đang mở
#3,317 2 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
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
lua
Lĩnh vực
devtools

Hướng nghiên cứu

Tái hiện chẩn đoán trong VS Code với LuaLS và addon Penlight, sau đó kiểm tra library/pl/tablex.lua quanh dòng 545, đặc biệt là hai định nghĩa tablex.filter. Theo dõi cách LuaLS phân giải các định nghĩa đó và xác minh rằng overload generic được chọn để ví dụ không còn báo cáo một đối số hàm không hợp lệ.

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

Mô tả

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Libraries

Expected Behaviour
local tablex = require("pl.tablex")

tablex.filter(
    {},
    function() end -- no linting error
)
Actual Behaviour
local tablex = require("pl.tablex")

tablex.filter(
    {},
    function() end -- Cannot assign `function` to parameter `"()"|"<"|"<="|"=="|">"...(+5)`. (...)
)
Reproduction steps
  1. Setup LuaLS and copy example code into a .lua file
  2. Install Penlight using the Addon Manager
Additional Notes

Here's an extract of the LuaDoc. LuaLS seems to always pick the second definition instead of the first one which has the annotations for using a generic function.

---@generic T, A
---@param t T[]
---@param pred fun(val: T, arg: A): any
---@param arg A
---@return T[]
---@nodiscard
function tablex.filter(t, pred, arg) end

---filter an array's values using a predicate function
---@generic T
---@param t T[] -- a list-like table
---@param pred pl.BoolBinOpString -- a boolean function
---@param arg any -- optional argument to be passed as second argument of the predicate
---@return T[]
---@nodiscard
function tablex.filter(t, pred, arg) end

https://github.com/goldenstein64/pl-definitions/blob/ef73834d7b54b989a4decf9f4598b83b3c9ef621/library/pl/tablex.lua#L545

Log File

I set --loglevel=trace and added the code to an empty file while having tail running on the log but there are no relevant details.

$ tail -f ./file_home_function_git_dragdown-modules.log
[13:59:35.741][debug][#0:script/vm/node.lua:490]: clearNodeCache
[13:59:35.741][trace][#0:script/files.lua:286]: Set text:       untitled:Untitled-1     takes   0.00012299999999987     sec.
[13:59:35.741][trace][#0:script/files.lua:695]: Compile State:  untitled:Untitled-1
[13:59:35.843][debug][#0:script/provider/provider.lua:1120]: textDocument/semanticTokens/range
[13:59:35.857][debug][#0:script/provider/diagnostic.lua:330]: publishDiagnostics        untitled:Untitled-1     2
[13:59:40.272][debug][#0:script/vm/node.lua:490]: clearNodeCache
[13:59:40.273][trace][#0:script/files.lua:286]: Set text:       untitled:Untitled-1     takes   0.00021399999999971     sec.
[13:59:40.373][trace][#0:script/files.lua:695]: Compile State:  untitled:Untitled-1
[13:59:40.374][debug][#0:script/provider/provider.lua:1120]: textDocument/semanticTokens/range
[13:59:40.381][info] [#0:script/provider/diagnostic.lua:171]: clearDiagnostics  untitled:Untitled-1
[13:59:47.118][debug][#0:script/vm/node.lua:490]: clearNodeCache
[13:59:47.118][trace][#0:script/files.lua:286]: Set text:       untitled:Untitled-1     takes   0.00020199999999981     sec.
[13:59:47.219][trace][#0:script/files.lua:695]: Compile State:  untitled:Untitled-1
[13:59:47.220][debug][#0:script/provider/provider.lua:1120]: textDocument/semanticTokens/range
[13:59:47.232][debug][#0:script/provider/diagnostic.lua:330]: publishDiagnostics        untitled:Untitled-1     2
Ngôn ngữ chính
Lua
Star
4.4k
Fork
442
Merge trung bình
8 ngày 9 giờ
Pull request đã merge (30 ngày)
1

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 LuaLS/lua-language-server

Tất cả issue của LuaLS/lua-language-server

Issue tương tự

Thêm issue về Lua

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.