Closed Yuelioi closed 2 months ago
+1
I have encountered the same issue - any region containing the last function in a class definition doesn't work correctly, getting placed at the end of the outline. This occurs regardless of the "Start Region" and "End Region" settings (I tried both # region
and #region
).
Having any statement after the "End Region" does show the outline correctly.
Setup:
I think this is because the DocumentSymbol
for the class defines the end range as the last source line, which doesn't include the last # endregion
.
I will try to see if there is an easy way to handle this - I am still familiarizing myself with the codebase.
I have a fix here: https://github.com/joshua-dean/outline-map/commit/855f89599fccebc72b7350d53b1b5d4b7f0137a7
When calling reconstructTree
, if the sibling is a "region", it only checks the start, not the end.
Result:
I am not sure if this is the best property to check. It doesn't seem to create any other issues.
I think this is only an issue with languages like python that use indentation for scope - languages like JavaScript have closing brackets that would ensure the region is contained. We might want to query the language for checks like this.
Are there any linting/formatting/testing I should complete, or do you think I'm good to open a PR?
@Yuelioi The 1.4.1 release fixed this for me. Is this issue also solved for you?
@Yuelioi The 1.4.1 release fixed this for me. Is this issue also solved for you?
Yes, it works well now
Bug 描述
当在python class中使用region时, 无法覆盖到最后一个函数, 如果region包含最后一个函数,则该region会失效