godotengine / godotengine/godot-vscode-plugin

Incorrect formatting for negative indices/keys

Open
#889 5 comments 1 reaction 0 assignees View on GitHub
bug formatter
Dominant language
TypeScript
Stars
2.1k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

### Godot version

4.4.1

### VS Code version

1.102.2

### Godot Tools VS Code extension version

2.5.1 as well as Dev Build (as of 2025-07-24)

### System information

Windows 11

### Issue description

Negative indices are not formatted correctly in certain situations. For example, `x[-1]` gets formatted to `x[ - 1]`.

### Steps to reproduce

The following code

```
some_array[-1] = 0
print(some_array[-1])
```
formats to
```
some_array[-1] = 0
print(some_array[ - 1])
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.