rhaiscript / lsp

Language server for Rhai.
Apache License 2.0
43 stars 4 forks source link

Minor formatting issues #103

Open schungx opened 1 year ago

schungx commented 1 year ago
switch x {
  _ => x
}

get formatted to:

switch x {
  x => x
}
schungx commented 1 year ago

One nit-pick: For default case, it puts two spaces after the underscore instead of one:

image

schungx commented 1 year ago

Since we're at it, here are a few more:

fn add(a, b) {
    a + b // comment
}

Result:

fn add(a, b) {
    a + b
}

The comment is gone.

schungx commented 1 year ago
fn add(a, b) {
    a + b; // a very very very looooooooonnnnnng long long long long long long comment
}

is formatted to:

fn add(a, b) {
    a
        + b; // a very very very looooooooonnnnnng long long long long long long comment
}

If a line comment is too long, the item gets moved to the second line, which looks strange.

schungx commented 1 year ago

image

Missing space before line comment if it is right after an open {.