-
-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infer pcall arguments from the first function parameter #3140
Comments
you can try the emmylua_ls,it support this feature |
no emmylua ls is write in rust:https://github.com/CppCXY/emmylua-analyzer-rust |
Ah ok. I thought you meant this one EmmyLua-LanguageServer. I will give it a shot. Thank you @CppCXY . |
Indeed it works @CppCXY. Cool stuff. But I wonder could we get autocomplete as well? Right now it just warns about the mismatch but does not present the arguments when typing. See |
Hi 👋
I was wondering if it would be possible for LuaLS to infer the types of the arguments passed to
pcall
based on the signature of its first function argument. This would significantly improve developer experience, especially when working with typed Lua (e.g., EmmyLua annotations) or when relying on auto-completion and type checking.Example:
In this case, it would be great if LuaLS could infer that greet expects a string, and therefore type-check or suggest "world" accordingly when passed to
pcall
.Currently, the parameters after the first one are not checked or suggested with much context, making it less ergonomic when using
pcall
(or other similar functions) for safe calls.The text was updated successfully, but these errors were encountered: