Skip to content

Missing trailing comma if last value is a string #2045

@kosorin

Description

@kosorin

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Formatting

Expected Behaviour

local str = {
  "foo",
  "bar", -- comma
}
local num = {
  "foo",
  23,
}
local bool = {
  "foo",
  true,
}
local tab = {
  "foo",
  {},
}

Actual Behaviour

local str = {
  "foo",
  "bar" --  missing comma
}
local num = {
  "foo",
  23,
}
local bool = {
  "foo",
  true,
}
local tab = {
  "foo",
  {},
}

Reproduction steps

  1. Format following document:
local str = {
  "foo",
  "bar"
}
local num = {
  "foo",
  23
}
local bool = {
  "foo",
  true
}
local tab = {
  "foo",
  {}
}

Additional Notes

Editor config option: trailing_table_separator = smart

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