sunjw / jstoolnpp

A JavaScript (JSON) tool for Notepad++ (formerly JSMinNpp) and Visual Studio Code.
GNU General Public License v2.0
284 stars 24 forks source link

Strange formatting of try finally blocks #126

Closed jpstotz closed 2 years ago

jpstotz commented 2 years ago

If I format a try-finally block or a try-catch - finally block the output is inconsistent regarding new lines and indentation:

    try {
       a();
    } finally {
       b();
    }

becomes

    try {
        a();
    }    
    finally {
        b();
    }

Note the line break before finally.

And for try-catch-finally:

    try {
        x();
    } catch (e) {
        y();
    } finally {
        z();
    }

becomes

    try {
        x();
    } catch (e) {
        y();
    }
    finally {
        z();
    }

Before catch there is no line break (correct) but before finally again a line-break is inserted which is a bit inconsistent.

Observed using JSTool not NPP v1.2202.0.0

sunjw commented 2 years ago

Fixed in 8a7fb6169416e008597eaab92869095339ee671a 1.2205.0 will release soon.