jcollard / elm-mode

Elm mode for emacs
GNU General Public License v3.0
373 stars 67 forks source link

Refurbish elm-mode #175

Closed theothornhill closed 3 years ago

theothornhill commented 3 years ago

Hello there!

For some time, I've grown my own elm-mode over at https://git.sr.ht/~theothornhill/elm-mode , but I feel it would absolutely be wiser to try to consolidate something over to the official one. This repo isn't really getting much love these days, but I would like to help.

What do you think about:

IMO the indentation code and this codebase in general is riddled with things from haskell-mode etc, and there is a lot of unrelated code. If you want to, take a look at my other mode. It is only ~350 lines of code, and feels better and more consistent indentation-wise and highlighting-wise than this mode.

By relying entirely on lsp we get a lot of things for free and can remove everything else. This would also keep us on par with vscode. I use elm daily at work, and would like to see better elm support in emacs.

If you are interested, then I can take over maintainership of this package down the line :)

Have a nice evening!

purcell commented 3 years ago
* Removing support for anything below 0.19

Yep, immediately in favour of this.

  • Enabling tree sitter for syntax highlighting, the same way I did in csharp-mode lately

Wary of this because it brings in a huge set of deps and it's not exactly idiomatic. Since much of the unfortunate haskell-mode baggage is unnecessary these days due to Elm's syntax simplifications since the early days, I feel like it could be replaced by something simpler: I just don't think tree-sitter is it. Ultimately Elm isn't a complex language to support idiomatically now.

  • Simplifying indentation to almost nothing

Again, the current indent engine could be replaced with a much simpler version, maybe using SMIE. Perhaps that simpler version could be yours.

I'm all for simplifying things in general, but this is working and widely-used code, so I'm also wary of spending a lot of time subsequently fixing issues that only get exposed when new code meets the wider userbase.

Would be good to think about incremental approaches.

theothornhill commented 3 years ago

Absolutely agree with tree sitter waryness. head~5 or smth like that features highlighting on par with vscode. It is a little spartan, but faster, considering tree-sitter-elm still is a little brittle.

I propose:

Should I start assembling some ideas?

purcell commented 3 years ago

Yep, sounds good. I guess I don't care about SMIE specifically.

I would hope that most people use elm-format anyway, so I think that we can assume some tolerance of differences in default indentation.

theothornhill commented 3 years ago

Just for context:

With tree sitter: image

without: image

But yeah, we can do that later :)

purcell commented 3 years ago

That's nice!