Skip to content
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

Required modules' returns' types are wrong when more than a single value is returned #1868

Open
artemking4 opened this issue Feb 1, 2023 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@artemking4
Copy link

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows WSL

What is the issue affecting?

Type Checking, Diagnostics/Syntax Checking, Libraries

Expected Behaviour

First type should be a number, second - a string, third - a boolean

Actual Behaviour

изображение

Reproduction steps

main.lua

local number, string, boolean = require "required"

required.lua

return 1337, "string", true

Additional Notes

No response

Log File

No response

@sumneko sumneko added bug Something isn't working enhancement New feature or request labels Feb 2, 2023
sumneko added a commit that referenced this issue Feb 2, 2023
2nd should be unknown since Lua 5.3, otherwise should be nil

#1868
@sumneko sumneko removed the bug Something isn't working label Feb 2, 2023
@sumneko sumneko added this to the 3.7.0 milestone Feb 2, 2023
@sumneko
Copy link
Collaborator

sumneko commented Feb 2, 2023

File can only return one value, I will add a diagnostic about it.

@artemking4
Copy link
Author

ehh, well, in some environments it can return more than one, can we have a switch or something for that?

@sumneko
Copy link
Collaborator

sumneko commented Feb 2, 2023

This is a non-standard behavior.
There are countless non-standard behaviors in the world, and I don't want to add switches to them one by one.

@artemking4
Copy link
Author

well, this library already supports non-standard environments, like love2d and special operators like /*, //, && and ||, so why not add this? Personally, i would expect this to be a feature even in the vanilla lua, not sure if it actually supports that though.
Is it something that is hard to implement maybe?

@sumneko
Copy link
Collaborator

sumneko commented Feb 2, 2023

well, this library already supports non-standard environments, like love2d and special operators like /*, //, && and ||, so why not add this?

This is why I added https://github.com/sumneko/lua-language-server/wiki/Plugins .
Besides, /* ,// are famous non-standard symbols, like I built in some famous environment definition files such as love2d, skynet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants