DanielGavin / ols

Language server for Odin
MIT License
417 stars 62 forks source link

odinfmt: Semicolons removed in switch expressions #255

Open jcmdln opened 11 months ago

jcmdln commented 11 months ago

When using odinfmt to format a file that contains a switch expression, the trailing semicolon is removed which causes a syntax error. This is with ols and odinfmt as of aef651f5.

// Working example before odinfmt
package main

main :: proc() {
    items: []string = []string{"Hellope!"}

    for i := 0; i < len(items); i += 1 {
        switch item := items[i]; {
        case "Hellope!":
            break
        }
    }
}
// Error example after odinfmt
package main

main :: proc() {
    items: []string = []string{"Hellope!"}

    for i := 0; i < len(items); i += 1 {
        // Syntax Error: Expected 'switch expression', found a simple statement.
        switch item := items[i] {
        case "Hellope!":
            break
        }
    }
}