GDQuest / GDQuest/GDScript-formatter

Make formater remember indentation of commented lines

Open
#204 7 comments 4 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
455
Forks
39
Avg merge
1d 15h
Merged PRs (30d)
4

Description

Hello,

I often quickly multiline comment functions or part of the code when refactoring.
Unfortunately the formater remove the indentation, so when uncommenting, the function is not valid anymore
In my current workflow, I have to disable the formater for now :(

Would it be possible to add an option to avoid that ?

Note: I do know about """ for commenting but not a huge fan of them, and the formater move them to the end of the file

Thanks you

Steps to reproduce:

1) Original Function:

``` gdscript
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.pressed:
if event.button_index == MOUSE_BUTTON_RIGHT:
print('test')
```

2) Adding multiline comments (CTRL+K)

```
#func _input(event: InputEvent) -> void:
#if event is InputEventMouseButton:
#if event.pressed:
#if event.button_index == MOUSE_BUTTON_RIGHT:
#print('test')
```

3) Formating the file

``` gdscript
#func _input(event: InputEvent) -> void:
#if event is InputEventMouseButton:
#if event.pressed:
#if event.button_index == MOUSE_BUTTON_RIGHT:
#print('test')
```

4) Uncomenting the lines (CTRL+K)

``` gdscript
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.pressed:
if event.button_index == MOUSE_BUTTON_RIGHT:
print('test')
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.