luisllamasbinaburo / VSCodeSnap

📸 Take beautiful screenshots of your code in VS Code!
https://marketplace.visualstudio.com/items?itemName=luisllamas.vscodesnap
GNU General Public License v3.0
22 stars 1 forks source link

Indentation Errors for multiple levels of nested ifs #2

Open zolrath opened 1 year ago

zolrath commented 1 year ago

Whe

const indentationTest = () => {
  if (thereAreIndentations) {
    return theyAreMisaligned; 
  }
  return notIdeal;
};

image

With just a bare, unwrapped if statement at the root of the file we still end up with a single extra space for the closing }

if (thereAreIndentations) {
  return theyAreMisaligned; 
}
return notIdeal;

image

It seems to add extra spaces to the } for every level of indentation: image

BartolomeyKant commented 1 year ago

It works fine for me, but there is some pecularities

If you select this code

  | selection starts on this column
  if (thereAreIndentations) {
    return theyAreMisaligned; 
  }
  return notIdeal;

it sees your code like this

screen-22-12-22:09-36-34

So there is no indentation before if but it is for other lines

zolrath commented 1 year ago

Hm I only became aware of this when someone sent me a screenshot with severely misspaced braces and was able to reproduce. I'm selecting the entire line in the above examples.

image