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

VM.OnCompileFunctionParam does not work at all

Đang mở
#3,343 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ó
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
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, tooling

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
  1. Write function VM.OnCompileFunctionParam(next, func, param) end in plugin.lua
  2. Add "Lua.runtime.plugin": "C:/Path/plugin.lua" to .vscode/settings.json or similar
  3. 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

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.