String and coments folding scope fix and restructuring #85016
+103
−54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This references issue #84820.
As no discussion was started in the reference issue i tried to fix it according to what seemed to be the expected outcome.
As of now, comments and strings are being folded based on the latest higher indentation level without taking comment/string fold blocks as units. My solution makes it so that they get treated as a block based on the indentation of the starting indent level of the block, which is how comment folding was already being treated and did not translate when they being recursively folded when folding a scope.
As I was finding it difficult to follow what was being done, I restructured fold_line and separated the functionality. If it is not desired it can be reverted easily while keeping the new added functionality.