question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Indent reset at certain level

See original GitHub issue

VS2017 Community MDK-SE v1.2.22

Indenting depth in the output gets reset after a certain depth. This example below shows a fragment of the output. It doesn’t seem to matter what’s going on in the code; when the indent level (or, possibly, the nesting level) reaches 4 deep in the initial source, it drops to 0 in the output.

Source fragment:

    void Init() {
      GridTerminalSystem.GetBlocksOfType(dummy, block => {
        if(Me.IsSameConstructAs(block)) {
          if(block is IMyShipDrill) {
            drills.Add((IMyShipDrill)block);
          } else
          if(block is IMyConveyorSorter) {
            sorters.Add((IMyConveyorSorter)block);
          } else
          if(block is IMyPistonBase) {
            pistons.Add((IMyPistonBase)block);
          } else
          if(block is IMyShipConnector) {
            var connector = (IMyShipConnector)block;
            if(connector.ThrowOut) {
              ejectors.Add(connector);
            } else {
              connectors.Add(connector);
            }
          } else
          if(block is IMyRefinery) {
            refineries.Add((IMyRefinery)block);
          } else
          if(block is IMyCargoContainer) {
            containers.Add((IMyCargoContainer)block);
          } else {
            if(block is IMyMotorRotor) {
              if(rotor == null) {
                rotor = (IMyMotorRotor)block;
              } else {
                throw new ConstraintException("Structure must include a single rotor");
              }
            }
          }
        }
        return false;
      });
    }

Output fragment:

    void Init() {
      GridTerminalSystem.GetBlocksOfType(dummy, block => {
if(Me.IsSameConstructAs(block)) {
  if(block is IMyShipDrill) {
    drills.Add((IMyShipDrill)block);
  } else
  if(block is IMyConveyorSorter) {
    sorters.Add((IMyConveyorSorter)block);
  } else
  if(block is IMyPistonBase) {
    pistons.Add((IMyPistonBase)block);
  } else
  if(block is IMyShipConnector) {
    var connector = (IMyShipConnector)block;
    if(connector.ThrowOut) {
      ejectors.Add(connector);
    } else {
      connectors.Add(connector);
    }
  } else
  if(block is IMyRefinery) {
    refineries.Add((IMyRefinery)block);
  } else
  if(block is IMyCargoContainer) {
    containers.Add((IMyCargoContainer)block);
  } else {
    if(block is IMyMotorRotor) {
      if(rotor == null) {
        rotor = (IMyMotorRotor)block;
      } else {
        throw new ConstraintException("Structure must include a single rotor");
      }
    }
  }
}
return false;
      });
    }

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
malware-devcommented, Sep 30, 2019

Oh - another tip. Rather than is -> cast, do

var drill = block as IMyShipDrill;
if (drill != null)
    drills.Add(drill);

You’ll save a cast.

1reaction
malware-devcommented, Sep 30, 2019

(PS: @ouroborus, you don’t need to pass in a dummy list. Just pass in null.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restart Numbered List changes the Hanging indent spacing
For single-level numbering, you should do the following: Right-click an item in the numbered list and choose Adjust List Indents from the ...
Read more >
Adjust indents and spacing in Word
Tip: To quickly change indents for an entire document, adjust the margins. Under Page Layout, select Margins, and choose the margin settings you...
Read more >
How to Adjust Bullet or Number List Indents in Microsoft Word
Place your cursor next to the text for the list item. · Go to the Home tab and click the arrow next to...
Read more >
How to adjust Indents in Microsoft Word - YouTube
This is a Microsoft Word tutorial covering, how to adjust Indents, tabs and borders. The tutor starts off by adjusting an indent in...
Read more >
How to Adjust the Indents and Tabs in Microsoft Word
To change the indentation for an entire document, select all text (press Ctrl + A ), then adjust the indent spacing in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found