-
-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Labels
bugSomething isn't workingSomething isn't working
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
lua-language-server/script/parser/compile.lua
Lines 429 to 430 in cb964c6
| local function resolveLongString(finishMark) | |
| skipNL() |
lua-language-server/script/parser/compile.lua
Lines 381 to 394 in cb964c6
| local function skipNL() | |
| local token = Tokens[Index + 1] | |
| if NLMap[token] then | |
| if Index >= 2 and not NLMap[Tokens[Index - 1]] then | |
| LastTokenFinish = getPosition(Tokens[Index - 2] + #Tokens[Index - 1] - 1, 'right') | |
| end | |
| Line = Line + 1 | |
| LineOffset = Tokens[Index] + #token | |
| Index = Index + 2 | |
| State.lines[Line] = LineOffset | |
| return true | |
| end | |
| return false | |
| end |
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) endLog File
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

