Skip to content

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

@artemking4

Description

@artemking4

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

Activity

removed
bugSomething isn't working
on Feb 2, 2023
added this to the 3.7.0 milestone on Feb 2, 2023
sumneko

sumneko commented on Feb 2, 2023

@sumneko
Collaborator

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

artemking4

artemking4 commented on Feb 2, 2023

@artemking4
Author

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

sumneko

sumneko commented on Feb 2, 2023

@sumneko
Collaborator

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

artemking4 commented on Feb 2, 2023

@artemking4
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

sumneko commented on Feb 2, 2023

@sumneko
Collaborator

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sumneko@artemking4

        Issue actions