Skip to content

Syntax warning / error not flagged as such. #3397

Open

Description

@Safebox36

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?

Diagnostics/Syntax Checking

Expected Behaviour

A warning or an error that the line in question is not complete, regardless of how the parser it's run in processes it:

local varA, varB functionCalledHere()

Actual Behaviour

No warning or error was given, resulting in a 20 minute hunt for a nil in one of the variables that shouldn't exist. The plugin did not flag the line as having a syntax warning or error, even if the Lua engine did not have an issue with the code per se.
Image

Reproduction steps

.

Additional Notes

Apologies for raising another issue, but I couldn't find any information on if this is a niche feature of Lua or a bug that just hadn't been fixed in 5.1. But if it's not a feature and is an unintended side-effort, I feel like it should be raised as a warning by the LLS to alert the user like "hey, are you sure this is what you were intending to do" similar to variables lacking a nil.

Log File

No response

Activity

  1. tomlau10 commented on Apr 6, 2026

    @tomlau10
    Contributor

    With some research, this is a valid syntax and "feature" for writing lua script in one line 😅 .
    You can just try to ask lua one line syntax without semicolon in google ai mode to see more details.

    As an example:

    local function test()
        return true
    end
    local a test()
    print(a) --> nil
    • because the above is treated like local a; test(), and that test() is executed alone
    • a will still be nil

    I am not sure if there should be a no-one-line diagnostic in LuaLS or not 😕

    Image

    so when you see a virtual semicolon in your code, you know that it is "smelly" 🤔


    PS: I found the default luals hint setting a bit distracting, so I also changed some of the default values:

        "Lua.hint.paramName": "Literal",
        "Lua.hint.arrayIndex": "Disable",
    

    you can know more details from the wiki page: https://luals.github.io/wiki/settings/#hint

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions