Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next round of Indentation Work #257

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Gastove
Copy link
Contributor

@Gastove Gastove commented Dec 19, 2020

Hello!

Apologies this took so long; I lost steam pretty badly when the unit test framework changed. Since then, I've been able to come back to both F# and learn buttercup (which is honestly lovely!), and now I'm back at it.

I don't think this PR should close anything; this work isn't complete. But, it's good progress -- a working, non-zero test suite and some improvements to how indentation works. Going to try and keep rolling with this. I'll make small updates to this PR if I find other things that seem appropriate to pull in, but otherwise I plan to mostly open new PRs for steadily more specific issues as I go.

Thanks very much!

…lock-p`

F#... doesn't have statements, which makes this name very, very confusing. This
is a straight rename.
This regex is a hot mess. Fortunately, it's unused.
Okay. This got really messy, and I need to pin everything down.

It turns out that F# indentation is _really hard_. Everything is relative, and
the only thing that matters is that *blocks line up*. That's fine, but also
hard. There are many cases where the "normal" behavior is to line up with a
particular part of the preceding line, rather than with a particular indent
level.

So.

This is slowly taking the approach that we should maintain a list of the levels
of indent, and we should see:

1. Ret *mostly* goes to the same level, except in certain cases when we
might *indent*
2. Tab will first increase indent one level, then go back to start, then
decrease through all the preceeding levels.
3. Indentation is for semantics, lining up blocks correctly so the compiler can
interpret them correctly. *Formatting* should be handled by Fantomas, either via
LSP or by calling it directly.
As the comment says: during testing, I'm finding that `electric-indent-inhibit`
is not being respected. This often causes the indent-line function to fire twice
-- which we detect and take specific action on, which means that it firing twice
is bad. Electric Indent Mode can be disabled per-buffer, so let's just do that.
This marks all the tests being up-to-date using buttercup *and passing*. Huzzah!
@Gastove
Copy link
Contributor Author

Gastove commented Dec 19, 2020

Having opened the PR, I can now see it is already more than big enough. I wont add more to this, beyond requests made here in review 👍

Did a pass, trying to remove unused things. Did not actually find many, alas.
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.

None yet

1 participant