godotengine / godotengine/godot-vscode-plugin

Since 2.6.0: extra space added before "self" keyword when following "!" or "["

Open
#976 3 comments 2 reactions 1 assignee Claimed by @DaelonSuzuka View on GitHub
bug formatter regression
Dominant language
TypeScript
Stars
2.1k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

### Godot version

4.5.1

### VS Code version

1.103.2 (Universal)

### Godot Tools VS Code extension version

2.6.0

### System information

maxOS Sequoia 15.7.3

### Issue description

Formatting a GDScript file will add an extra space when the `self` keyword follows either `!` or `[`, turning `!self` into `! self` and `[self]` into `[ self]`. This issue showed up after upgrading to 2.6.0 and 2.6.1. Reverting to 2.5.1 removed the issue.

I can't find any editor/formatter settings with 2.6.0 that has anything to do with this issue, so I'm assuming it to be a bug.

This issue is similar to the one reported by https://github.com/godotengine/godot-vscode-plugin/issues/972.

### Steps to reproduce

1. Type `if !self.member == 1:` and `var array = [self.member]`
2. Format the document

Expected: no changes
Observed: code is formatted into `if ! self.member == 1:` and `var array = [ self.member]`

Note: This only happens when the `self` keyword is used. `if !member == 1:` and `var array = [member]` will not be formatted.

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.