Closed arnoson closed 3 years ago
I suppose you would define a class and give it the fields of the arguments you desire.
---@class MyArgs
---@field arg1 number
---@field arg2 string
---@param args MyArgs
function test(args)
print(args.arg1)
print(args.arg2)
end
test { arg1 = 10, arg2 = "somestring" }
---@param args {arg1: number, arg2: string} function test(args) end
Thanks for your quick replies!
I use this lua plugin for vscode and both techniques don't seem to work properly, although the plugin uses EmmyLua.
Here the detailed param Information is not displayed, only the type of the MyArgs
class:
And here the syntax is not recognized:
So I guess the second solution should work great if another part of the plugin wasn't interfering. I will try out to use EmmyLua directly to see if it solves the problem.
There is already an issue filed for the plugin im using: sumneko/lua-language-server#511 So I'll close this issue as it doesn't seem to be related to EmmyLua. Thanks for your help :)
Environment(环境)
Is there any way to document named arguments that I haven't found yet? What im looking for is to document something like this:
I guess a notation like this would be great: