Skip to content

Conversation

@peteraldous
Copy link

All of the SML tools I've used format code differently from what I expect; lines beginning with | are indented, but the convention I'm used to is that if it's an alternate pattern for the fun, the | should match and not be indented further:

fun fact 0 = 1
|   fact n = n * fact (n-1);

I modified the indentation logic to change this behavior. I'm new to vimscript and plugins; I will happily accept edits or implement suggestions.

@jez
Copy link
Owner

jez commented Sep 25, 2024

Hey, thanks for the suggestion.

I like the way it indents right now, and I have to assume that the majority of people using this plugin also use it because they like the current indentation behavior.

I checked some SML formatters:

And they all format fun patterns the way that this indentation plugin formats them.

I'm open to building this behind a configuration option, so long as the default (unconfigured behavior) is the same as the current behavior.

I believe a good name would be g:sml_indent_fun_pipe_position, accepting two string values: "begin" and "indented". You can read :help get() for information on how to get the user's configured value or else fall back to a default value.

If you go with this approach, please be sure to update the :help vim-better-sml-config section to document what this option does.

Copy link
Owner

@jez jez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants