LuaLS / LuaLS/lua-language-server

Redundant "Unable to execute code after break" diagnostic is given when using a label after a break

Open
#2,686 0 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?

Kakoune

### Which OS are you using?

Linux

### What is the issue affecting?

Diagnostics/Syntax Checking

### Expected Behaviour

No diagnostic is given.

### Actual Behaviour

A diagnostic `Unable to execute code after 'break'` is given, even though the only thing after the `break` is a label.
![image](https://github.com/LuaLS/lua-language-server/assets/3515394/5e8c258d-e553-4d8d-8a43-086ddab540d9)

### Reproduction steps

Reproducible with the following code:
```lua
for i = 1, 10 do
if i < 8 then
print(i)
goto continue
end
break
::continue::
end
```

### Additional Notes

_No response_

### Log File

The log isn't very relevant in this case but here it is anyway.
[luals.log](https://github.com/LuaLS/lua-language-server/files/15503586/luals.log)

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

Start with the Lua reproduction under Diagnostics/Syntax Checking and run it through the language server in Kakoune on Linux. Trace where the `Unable to execute code after 'break'` diagnostic is produced, then verify that the diagnostic is absent when the only following statement is the `::continue::` label.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.