godotengine / godotengine/godot

GDScript suggests closing curly brace when comma is missing in dictionary

Open
#98,244 4 comments 0 reactions 0 assignees View on GitHub
discussion topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in 4.3.stable.arch_linux

### System information

Arch Linux, Vulkan 1.3.280 - Forward+, NVIDIA GeForce GTX 1080 Ti

### Issue description

When forgetting to add a comma after a dictionary entry, the engine will give an error saying:
> "Expected closing "}" after dictionary elements."

It wrongfully presumes the developer forgot to add a closing bracket, while the developer actually forgot to add a comma.

### Steps to reproduce

Just create a dictionary with atleast 2 entries and don't add a trailing comma after an entry. Using GDScript.

```gdscript
var ExampleDictionary = {
"Key1": "Value1" # <- There should be a comma here
"Key2": "Value2" # <- Here as well
}
```

### Minimal reproduction project (MRP)

Just a new project.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied GDScript dictionary reproduction in a new Godot project and inspect the parser diagnostic it produces. Trace the parser path for dictionary elements and compare the reported error with the missing-comma case; done means the diagnostic no longer incorrectly suggests only a missing closing brace.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.