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

Improve speed of smie by disabling features #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

axelson
Copy link
Contributor

@axelson axelson commented Dec 19, 2021

This PR disables the worst offenders of lookbacks that make opening large files very slow.

More testing is needed to determine if this is a worthwhile tradeoff. The main reason it is palatable is that it fixes
#463 and indentation isn't as important as it once was because you can simply run elixir-format (or lsp-format-buffer).

This probably isn't fit to merge as-is. At the very least we'd want to completely remove elixir-smie--semi-ends-match

Also in the future it would be very nice to replace the entire elixir-smie with https://codeberg.org/FelipeLema/tree-sitter-indent.el.git

This PR disables the worst offenders of lookbacks that make opening
large files very slow.

More testing is needed to determine if this is a worthwhile tradeoff.
The main reason it is palatable is that it fixes
elixir-editors#463 and
indentation isn't as important as it once was because you can simply run
`elixir-format` (or `lsp-format-buffer`).
@wkirschbaum
Copy link
Contributor

tree-sitter-indent will require an external dependency right? it would be great to have basic indentation working without external dependencies if someone just wants to try out elixir in emacs without adding too much complexity.

forward-sexp seems to not work properly in elixir-mode, so maybe it is worth fixing that and see if indentation can be simplified. i will have a go at this this week.

@axelson
Copy link
Contributor Author

axelson commented Dec 21, 2021

@wkirschbaum that would be great 👍

And yes tree-sitter-indent would be an external dependency.

@wkirschbaum
Copy link
Contributor

Emacs is adding treesit which seems to be an optional compilation dependency based on the distro. After struggling with SMIE since December I did not get very far and optional dependency is good enough 😓 - gave it an honest go. treesitter can be used for indentation, fontification and navigation. Here is fontification working pretty well: #495

@victorolinasc
Copy link
Contributor

Hi @wkirschbaum ! I am curious to what would be a different approach for a major mode syntax table without tree-sitter and without SMIE. You've mentioned you´d like to do that in another issue and got me curious as how you'd go about doing that.

If you have any other modes done this way as benchmarks/inspiration that would be cool too!

In the meanwhile I might spend some more days delving into the deeps of SMIE and see if I get better results here... I think this is unlikely and probably will just spend some time here... but let's see...

@wkirschbaum
Copy link
Contributor

@victorolinasc I spend months trying to tweak SMIE to not be in the way and could not get it right. On your question, I don't really know, but want to spend some time on it to have a look at other modes. Maybe a simpler SMIE gramamar? Not sure.

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

3 participants