Skip to content

unnecessary newline added when format on paste is enabled #1606

@xiangnanscu

Description

@xiangnanscu

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?

Formatting

Expected Behaviour

When I refine my code I usually need to copy and paste some code in an inserting style. In this case, could the ext check if there is a line in the next position so doesn't add newline? format on paste is a useful option, I don't want to turn it off.

local function foo()
  -- try to paste 'local a= 1' here
  local b = 2
end

expected:

local function foo()
  local a = 1
  local b = 2
end

Actual Behaviour

local function foo()
  local a = 1

  local b = 2
end

Reproduction steps

just as above

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfeat/formatterRelated to code formatter

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions