It's a little weird but VSCode randomly indent lines incorrectly. I have worked out a MWE below.
How to replicate.
Copy the following code to Julia editor
Run "Format Document"
Result: the jc_today line got flushed left (i.e. no indent)
Note that the code does not make any sense because I have deleted everything that doesn't cause the indent problem. And funny enough, if I comment out any line then the problem goes away.
function commander(c::Client, m::Message, ::Val{:julia_con})
arg = (occursin(r"[0-9]+", args[1]) ? "jc" : "") * args[1]
end
function jc_execute(c, m, ::Val{:now}, args)
tz_arg = isempty(args) || !TimeZones.istimezone(args[1]) ? "UTC" : args[1]
current = ZonedDateTime(now(), TimeZone(tz_arg))
end
function jc_execute(c, m, ::Val{:today}, args)
tz_arg = isempty(args) || !TimeZones.istimezone(args[1]) ? "UTC" : args[1]
dt = now(TimeZone(tz_arg))
jc_today(c, m, dt)
return nothing
end
My workaround is a little stupid:
jc_today(c, m, dt) # just adding a comment fixes indenting
The problem is that it's broken randomly. It's hard for me to catch every line that's broken and add a comment everywhere.
It's a little weird but VSCode randomly indent lines incorrectly. I have worked out a MWE below.
How to replicate.
jc_today
line got flushed left (i.e. no indent)Note that the code does not make any sense because I have deleted everything that doesn't cause the indent problem. And funny enough, if I comment out any line then the problem goes away.
My workaround is a little stupid:
The problem is that it's broken randomly. It's hard for me to catch every line that's broken and add a comment everywhere.