Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

VM.OnCompileFunctionParam does not work at all

Aperta
#3,343 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
lua
Ambito
devtools, tooling

Direzione di ricerca

Inizia con la riproduzione del plugin in plugin.lua e con il percorso di caricamento referenziato da script\plugin.lua:157, quindi confronta il punto di ingresso documentato VM.OnCompileFunctionParam con l’hook funzionante OnSetText. Riproduci l’errore VM nil usando la configurazione .vscode/settings.json mostrata. Il lavoro è completato quando il callback può essere definito e invocato senza l’errore VM globale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Lua
Stelle
4.4k
Fork
442
Merge medio
8g 9h
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LuaLS/lua-language-server

Tutte le issue di LuaLS/lua-language-server

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.