Syntax suggestion: end<control>

That was one of the bigger reasons why I lost interest in the Go language.

1 Like

Having a block that does not fit on the screen is almost surely code smell in Julia. Instead of expecting the language or an external tool to protect you from this, you should break up your code into smaller functions.

1 Like

As I said, this is useful mostly for modules and types. You can’t break anything up there.

My understanding is that the original proposal (and most of the discussion) was for all blocks.

That said, module ... end is regularly broken up to pieces, using include. Composite types longer than a screen are, again, code smell, and are fortunately rare.

Correct, but I also mentioned this point all the way up

That is not always a solution for some nested modules.

This is definitely not true. I agree it shouldn’t happen for all types but anything with more than one or two inner constructor can easily be long and that is not a problem at all.

And again, I don’t think changing (adding to) the keywords is the right solution here, comment is enough, I’m replying again just because people keep saying that long block shouldn’t exist.

3 Likes

Is this true with Atom+Juno? I don’t see them but maybe I need an extra package?

Yes. It’s in Settings > Editor > Show Indent Guide.

1 Like

I’d also recommend the indent-guide-improved package because it clearly indicates at what level of indentation the cursor is at:

IMHO it’s a bit ugly by default but you can add the following to your styles.less

.indent-guide-improved {
  background-color: @syntax-text-color !important;
  opacity: 0.2;
  &.indent-guide-stack {
    opacity: 0.5;
    &.indent-guide-active {
      opacity: 0.9;
    }
  }
}

2 Likes

That’s pretty cool. Somewhat amusingly, the indent guide failed to work inside my styles.less because you use two spaces as tabs:


:wink:

Is there a way to automatically fix 2 → 4 tab length? Atom Beautify apparently does not support Julia.

indent-dective works quite well since I fixed it in the last release. :slight_smile:

Maybe I’m missing something, but doesn’t indent-detective just discover what the correct indentation is in a file? Does it also re-indent copy-pasted code to the correct indentation?

Yeah I just noticed I didn’t answer your actual question. You can force the indent to 4 spaces (either by using indent-detctive or some other way) and the use the Editor: Auto Indent command. Note that that might mess up any non-standard indents though.

1 Like

Yess. It works :slight_smile: