LuaLS / LuaLS/lua-language-server

Comment block adds code oddly when new line is added

Open
#2,375 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

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?

Completion

Expected Behaviour

Nothing special happens when adding a new line to the end of a comment block.

Actual Behaviour

The end of the comment block is duplicated.

Reproduction steps

In a new X.lua file add the below as the only content.

--[[
    Can teleport a player to near a target. Handles vehicles, finding valid placements and checking walkable paths based on settings.

    HERE

    end of comment
--]]

At the end of the word HERE add a new line by pressing enter and see the end of the comment block below it duplicated.

It produces the below.

--[[
    Can teleport a player to near a target. Handles vehicles, finding valid placements and checking walkable paths based on settings.

    HERE


    end of comment
--]]


    end of comment
--]]
Additional Notes

https://github.com/LuaLS/lua-language-server/assets/40836017/3b1e6ddc-7ac0-4184-9e25-c644b462d92e

Log File

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the completion behavior in Visual Studio Code using a new X.lua file containing the reported block comment, then inspect the Lua language-server completion path for edits triggered by Enter inside a comment block. Done means pressing Enter after HERE no longer duplicates the trailing comment text and --]] terminator.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.