Skip to content

Codestyle-check warnings generate empty diagnostics for incorrect quote_style #1986

@ibhagwan

Description

@ibhagwan

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Formatting

Expected Behaviour

Expect to get a meaningful formatter warning.

Actual Behaviour

Whenever a file has an incorrect quote style (i.e. single when double is prefferred) lua_ls will produce an empty warning that always points out to line one of the file.

Reproduction steps

Use quote style double in your .editorconfig:

# see https://github.com/CppCXY/EmmyLuaCodeStyle
[*.lua]
# [basic]

# optional space/tab
indent_style = space
# if indent_style is space, this is valid
indent_size = 2
# if indent_style is tab, this is valid
tab_width = 2
# none/single/double
quote_style = double

# other options below

Enable warning in .luarc.json with codestyle-check = Any:

{
    "runtime.version": "LuaJIT",
    "diagnostics": {
        "enable": true,
        "globals": [
          "vim",
          "describe",
          "pending",
          "it",
          "before_each",
          "after_each",
        ],
        "neededFileStatus": {
          "codestyle-check": "Any"
        }
    },
    "workspace": {
        "library": [
            "runtime/lua",
        ],
        "checkThirdParty": false,
        "maxPreload": 2000,
        "preloadFileSize": 1000
    },
    "telemetry.enable": false
}

Open this lua file within the same folder:

print("test")
print('test')

As long as the line with single string wrap exists lua_ls generates the below warning (neovim):
image
image

Once I modify the single string wrapped to a double (or change to quote_style = none) the warning disappears:
image

Additional Notes

As long as one line with what's deemed incorrect quote style exists in the file, no matter where inside the file a single empty diagnostics warning will be generated pointing to line 1 col 1 of the file.

Log File

No response

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