LuaLS / LuaLS/lua-language-server
Parser. Long string doesn't contain leading spaces
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?
Diagnostics/Syntax Checking
Expected Behaviour
local a = " sss "
print('"' .. a .. '"')
local a = [[ sss ]] -- bug with a leading spaces
print('"' .. a .. '"')
local a = [[sss]]
print('"' .. a .. '"')
local a = [[
sss]]
print('"' .. a .. '"')
local a = [[
sss]] -- bug with a leading space
print('"' .. a .. '"')
local a = [[sss
]]
print('"' .. a .. '"')
local a = [[
sss
]]
print('"' .. a .. '"')
local a = [[
sss
]] -- bug with a leading space
print('"' .. a .. '"')
Parser should produce strings according to Lua rules - in a long string only the first line break is removed, but if it is the first
" sss "
" sss "
"sss"
"sss"
"
sss"
"sss
"
"sss
"
"
sss
"
Actual Behaviour
The leading spaces were skipped, presumably due to the fact that these are not tokens. Or I don't know
Reproduction steps
- Try to parse long string
[[ sss ]] - Now its
[[sss ]]
Additional Notes
This also breaks the colorization in addition to #3032, most likely because it breaks the start/finish positions #3028
--[===[@param a string?ComMMul]===]
local function new(a) end
--[===[ @param a string?ComMMS1]===]
local function new(a) end
Log File
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with script/parser/compile.lua at the referenced lines 381-394 and 429-430, then reproduce the listed long-string cases. Compare parsed values and source ranges with the expected Lua outputs, including leading spaces and line breaks. Done means leading spaces are preserved and the affected colorization and start/finish positions no longer regress.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100