Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsing a func that ends in a region shows #endregion #90825

Open
Janosoft opened this issue Apr 18, 2024 · 7 comments
Open

Collapsing a func that ends in a region shows #endregion #90825

Janosoft opened this issue Apr 18, 2024 · 7 comments

Comments

@Janosoft
Copy link

Tested versions

  • Reproducible in Godot 4.2.1

System information

Windows 11 - Godot 4.2.1 stable - Compatibility render

Issue description

Using GDScript, collapsing a function that ends in a region returns #endregion

Steps to reproduce

func test():
#region Test
print_debug("hi")
#endregion

-> then collapse the func

Minimal reproduction project (MRP)

N/A

@dalexeev
Copy link
Member

Confirmed in master. I'm not sure if this can really be considered a bug, since there are 2 overlapping collapsing regions:

func test():          # Begin indent region.
#region Test          # Begin comment region.
    print_debug("hi") # End indent region.
#endregion            # End comment region.

СС @Paulb23

@kitbdev
Copy link
Contributor

kitbdev commented Apr 19, 2024

This is unrelated to regions, it happens with all comments after the expected end. (and endregion counts as a comment here)

func test():
    print_debug("hi")

# this will be folded.

@Janosoft
Copy link
Author

It's not ohhhh WHAT A BUG MAN!
but it is somewhat annoying, and it would be nice to be able to contribute to improving Godot

@DinDotDout
Copy link
Contributor

DinDotDout commented Apr 30, 2024

I have also found that something like:

#test
#region New Code Region
func _process(delta):
    pass
#endregion

and folding test will also fold the beginning of fold region.

@DinDotDout
Copy link
Contributor

PR #85016 ensures that comments on adjacent lines are treated as a block, based on the indentation level of the first line. This does not impact regions. This functionality could potentially be incorporated into the PR, as a more comprehensive method for determining what should and shouldn’t be folded is already being addressed.

@DinDotDout
Copy link
Contributor

Region folds may not have a clear answer as the folding the function in the following code should only close up until "var x" unless regions override the fold scope, which may result in more confusing behavior.

func _process(delta):
#region New Code Region
    pass
var x
#endregion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants