VM.OnCompileFunctionParam does not work at all
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng việc tái hiện plugin trong plugin.lua và đường dẫn tải được tham chiếu bởi script\plugin.lua:157, sau đó so sánh điểm vào VM.OnCompileFunctionParam được ghi trong tài liệu với hook OnSetText đang hoạt động. Tái hiện lỗi VM nil bằng cấu hình .vscode/settings.json được hiển thị. Được xem là hoàn tất khi callback có thể được định nghĩa và gọi mà không có lỗi VM toàn cục.
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?
Plugins
Expected Behaviour
According to https://luals.github.io/wiki/plugins/#vmoncompilefunctionparam, VM.OnCompileFunctionParam() is supposed to work.
Actual Behaviour
It simply does not work, and throws this error instead:
2026-01-28 20:58:08.342 [info] C:\Path\plugin.lua:4: attempt to index a nil value (global 'VM')
stack traceback:
C:\Path\plugin.lua:4: in main chunk
[C]: in global 'xpcall'
script\plugin.lua:157: in function <script\plugin.lua:95>
2026-01-28 20:58:08.348 [info] [Error - 8:58:08 PM] An error occurred in the plugin, please report it to the plugin author.
Please check the details in the output or log.
Plugin path: C:\Path\plugin.lua
Reproduction steps
- Write
function VM.OnCompileFunctionParam(next, func, param) endin plugin.lua - Add
"Lua.runtime.plugin": "C:/Path/plugin.lua"to.vscode/settings.jsonor similar - The error happens
Additional Notes
Please note that OnSetText() works as advertised, so the plugin system works; it is only this specific feature that does not seem to be working correctly.
For context, my library has JS-style event callbacks that work roughly like this:
addHook("PlayerUpdate", function(player)
end)
As you probably guessed already, I was hoping to use VM.OnCompileFunctionParam() to make it detect the parameter's type without requiring explicitly annotations, since generics do not seem to support this pattern at the moment?
I could also use OnSetText() instead, but it sounds like a less reliable method as it depends on the formatting, and it would also cause a warning about duplicate annotations if the user typed the ---@param explicitly.
Log File
No response
- 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
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 LuaLS/lua-language-server
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
LuaLS/lua-language-server#3463 · 5 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
LuaLS/lua-language-server#3461 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
LuaLS/lua-language-server#3460 · 1 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
LuaLS/lua-language-server#3459 · 1 reaction ·
Tất cả issue của LuaLS/lua-language-server
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
LandSandBoat/server#11579 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reaction ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mailcow/mailcow-dockerized#7480 ·
-
Mapper: a failed area image export crashes Mudlet if the profile closed while it was running Đang mởmapper bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
documentation feature-request mini.completion
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100