obiwan87 / odin-intellij

Odin Support plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/22933-odin-support
MIT License
37 stars 3 forks source link

Indentation is missing for the lines inside a foreign block on reformat #53

Closed Dima-369 closed 2 months ago

Dima-369 commented 2 months ago

Test with this (taken from my test to write bindings for https://github.com/sheredom/subprocess.h):

package subprocess

import "core:c"
import "core:c/libc"

foreign import subprocess "libsubprocess.a"

subprocess_s :: struct {
    stdin_file: ^libc.FILE,
    stdout_file: ^libc.FILE,
    stderr_file: ^libc.FILE,
    // assume that pid_t is an int
    child: c.uint,
    return_status: c.int,
    alive: c.size_t,
}

foreign subprocess {
    subprocess_create :: proc (command_line: [^]cstring, options: c.int, out_process: ^subprocess_s) -> c.int ---
}

After reformat, it incorrectly looks like this:

foreign subprocess {
subprocess_create :: proc (command_line: [^]cstring, options: c.int, out_process: ^subprocess_s) -> c.int ---
}

I would expect the file to stay the same as the input, as usually all lines are indented inside a foreign block.

obiwan87 commented 2 months ago

Found the bug

obiwan87 commented 2 months ago

Fixed with ee57c98