zokugun / vscode-explicit-folding

Customize your Folding for Visual Studio Code
MIT License
95 stars 14 forks source link

Folding multiple levels of child nodes #89

Closed tareqimbasher closed 1 year ago

tareqimbasher commented 1 year ago

Describe the issue

I'm trying to figure out how to get the plugin to fold the regions I want it to with a custom format

To reproduce

Code Example

[93,003 ms] Blink.Workflow.Commands.ReApplyTemplateSet.ReApplyTemplateSetCommand
├─> [3 ms] Blink.Data.Events.ReApplyTemplateSetPreEvent
├─> [313 ms] SetFieldValueCommand: Set Loan.LoanType to <null>
|   ├─> [2 ms] FieldValueChangingEvent: Changing Loan.LoanType from "FHA" to <null>
|   └─> [309 ms] FieldValueChangedEvent: Changed Loan.LoanType from "FHA" to <null>
|       ├─> [2 ms] Built-in action plan (APRCalculation)
|       ├─> [5 ms] Built-in action plan (CLTVCalculation)
|       |   └─> [3 ms] SetFieldValueCommand: Set Loan.CLTV to <null>
|       |       └─> [3 ms] FieldValueChangingEvent: Changing Loan.CLTV from <null> to <null>
|       ├─> [2 ms] Built-in action plan (LoanTypeChangeLogic)
|       ├─> [7 ms] Built-in action plan (NMLSFirstMortgageTypeLogic)
|       |   └─> [5 ms] SetFieldValueCommand: Set Loan.NMLSFirstMortgageType to "OtherFixed"
|       |       ├─> [2 ms] FieldValueChangingEvent: Changing Loan.NMLSFirstMortgageType from "GovernmentFixed" to "OtherFixed"
|       |       └─> [2 ms] FieldValueChangedEvent: Changed Loan.NMLSFirstMortgageType from "GovernmentFixed" to "OtherFixed"
|       ├─> [1 ms] Built-in action plan (TotalLoanAmountCalculation)
|       ├─> [1 ms] Built-in action plan (VAFundingFeeCalculation)
|       ├─> [73 ms] Built-in action plan (ProposedTotalRemainPmtsCalculation)
|       |   ├─> [39 ms] Blink.Loans.Queries.GetAmortizationSchedule.GetAmortizationScheduleQuery
|       |   |   ├─> [3 ms] SetFieldValueCommand: Set Loan.MI78TerminationDt to <null>
|       |   |   |   └─> [2 ms] FieldValueChangingEvent: Changing Loan.MI78TerminationDt from <null> to <null>
|       |   |   ├─> [3 ms] SetFieldValueCommand: Set Loan.MI80TerminationDt to <null>
|       |   |   |   └─> [2 ms] FieldValueChangingEvent: Changing Loan.MI80TerminationDt from <null> to <null>
|       |   |   └─> [4 ms] SetFieldValueCommand: Set Loan.FirstPmtWithOutMIDt to <null>
|       |   |       └─> [2 ms] FieldValueChangingEvent: Changing Loan.FirstPmtWithOutMIDt from <null> to <null>
|       |   └─> [13 ms] SetFieldValueCommand: Set Loan.ProposedTotalRemainPmts to "2.3"
|       |       ├─> [2 ms] FieldValueChangingEvent: Changing Loan.ProposedTotalRemainPmts from "10381.10" to "2.3"
|       |       └─> [10 ms] FieldValueChangedEvent: Changed Loan.ProposedTotalRemainPmts from "10381.10" to "2.3"
|       |           └─> [7 ms] Built-in action plan (RemainingPaymentChangeCalculation)
|       |               └─> [6 ms] SetFieldValueCommand: Set Loan.RemainingPaymentChange to "-2.30"
|       |                   ├─> [2 ms] FieldValueChangingEvent: Changing Loan.RemainingPaymentChange from "-10381.10" to "-2.30"
|       |                   └─> [2 ms] FieldValueChangedEvent: Changed Loan.RemainingPaymentChange from "-10381.10" to "-2.30"
|       ├─> [5 ms] Built-in action plan (TLTVCalculation)
|       |   └─> [3 ms] SetFieldValueCommand: Set Loan.TLTV to <null>
|       |       └─> [2 ms] FieldValueChangingEvent: Changing Loan.TLTV from <null> to <null>
|       ├─> [1 ms] Built-in action plan (PricingCombinedRatePctCalculation)
|       └─> [1 ms] Built-in action plan (PricingExistingCombinedRateCalculation)
└─> [7 ms] Blink.Data.Events.ReApplyTemplateSetPostEvent
    └─> [3 ms] [ERR] Built-in action plan (NTBRecoupNullCalculation) - Object reference not set to an instance of an object.

Settings

I've tried a number of combinations with start/end and separator..etc with varying degrees of success, but I can't seem to get it right.

"explicitFolding.rules": {
        "ini": [
            {
                "begin": "─>",
                "end": "─>" // can't figure out how to tell it to include childs if the they match the same indentation level
            },
            {
                "indentation": true,
                "offSide": true,
            }
        ]
    }

Expected behavior

I want to be able to fold regions with the -> marker while respecting indentation so that parent nodes fold include all sub-nodes

Additional context

This is a custom log format. I'm using INI format to view it in VS Code.

Thank you for a great extension!

daiyam commented 1 year ago

With the current rules, I can't think of a possible solution for your issue.

Maybe by adding nested into the begin/while rule, it might be possible...

tareqimbasher commented 1 year ago

OK fair enough. I ended up writing my own extension that encompasses a few other features in addition to folding. Thank you!