fsharp / fsharp/emacs-fsharp-mode
Clean Up, Modernize, and Debug Indentation
- Dominant language
- Emacs Lisp
- Stars
- 215
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Indentation comments on the issue tracker here are somewhat common, and difficult to resolve. `fsharp-mode` has not one but _two_ indentation modules -- [fshap-mode-indentation](https://github.com/fsharp/emacs-fsharp-mode/blob/master/fsharp-mode-indent.el) and [fsharp-mode-indentation-smie](https://github.com/fsharp/emacs-fsharp-mode/blob/master/fsharp-mode-indent.el). `fsharp-mode-indentation`, in particular, contains a great deal of historic cruft, from blocks of unexplained comments to totally unrelated functions.
`lsp` brings with it a lot of very appealing functionality, including F# formatting. And: `fsharp-mode` still needs to be able to handle indentation well along several lines. Partly, this is because it makes writing F# using Emacs vastly more pleasant to have good, correct indentation support. More concretely, however, is the fact that in F#, whitespace is syntactically significant _and_ often computationally un-guessable.
Currently, in `fsharp-mode`, there are cases in which it is impossible to get correct indentation without forcing it. Consider an example from an `Expecto` test:
```fsharp
let tests =
testList "Serialization Round-Tripping"
[ testCase "beep" <| fun _ ->
|]
```
`fsharp-mode` _will not_ indent point (indicated by `|`) past the exact column of the `t` in `testCase`.
### Proposal
I'd like to work on this, and I propose to do the following:
1. Verify that `smie` configs are correct, and being applied correctly.
1. Remove unneeded comments, unused code.
1. Move code not related to indentation out of `fsharp-mode-indentation` -- some to a new module, some to `fsharp-mode`.
1. Start a slow refactor to remove unneeded code.
1. Modify indentation code to behave... better, at least.
This is _absolutely_ more than one PR.
In terms of changes to make: "unneeded code" is a much harder question to answer than I'd like. `smie` configures _some_ things duplicated in `fsharp-mode-indentation`. I expect, in general, to remove _some_ amount of code from `fsharp-mode-indentation`, beyond removing i.e. functions not related to indentation. When this is done, perhaps the `smie` configs can be merged in to `fsharp-mode-indentation` sensibly.
### Indentation Issues to be Resolved by This Work
- [ ] #41
- [ ] #211
- [ ] #68
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.