tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
152 stars 36 forks source link

Freezes on typing stuff at the end of a file #12

Closed banacorn closed 3 years ago

banacorn commented 6 years ago

The whole editor would freeze (and spike CPU usage to 99%) if I type some stuff at the end of a file.

I haven't been able to identify the exact sequence of actions to reproduce the freeze, because it would almost always freeze when I try to type anything.

After some tinkering I think the problem comes from the scanner.

rewinfrey commented 6 years ago

@banacorn thanks for filing this issue. @maxbrunsfeld and I did some work on the external scanner and uncovered a condition that could result in non-termination. Those changes have been pushed to master, and should prevent your Atom instance from freezing. Do you mind checking out the latest master and verifying if the infinite looping is still occurring for you?

banacorn commented 6 years ago

Thank you for looking into this! I've tried out the latest scanner but it still freezes after a few keystrokes 😢

rewinfrey commented 6 years ago

@banacorn This is definitely on our radar, but as I'm still working on adding more Haskell language support for its multitude of language extensions, I've not prioritized getting this working in Atom yet. Thank you for your patience.

banacorn commented 6 years ago

I want to fix this, but I can't locate the source of the problem.

Could it be the scanner? If so, then perhaps instead of adding new stuff, should we fix the non-termination first? Could it be tree-sitter or Atom? If so, then perhaps other packages that also rely on external scanners could face this problem, too?

rewinfrey commented 6 years ago

@banacorn it's my understanding Atom currently isn't configured to use the get_column API that tree-sitter-haskell's external scanner depends on for parsing layout rules. This won't affect other external scanners because as of right now, tree-sitter-haskell is the only grammar that requires the get_column API (and is the motivation for why it was added to tree-sitter). @maxbrunsfeld please correct me if I'm misunderstanding!

@banacorn, unfortunately there are other problems with the external scanner not parsing some layout cases correctly. At this time I would say tree-sitter-haskell is still not stable enough to depend on for other packages and is still a WIP.

clojj commented 5 years ago

@banacorn, unfortunately there are other problems with the external scanner not parsing some layout cases correctly. At this time I would say tree-sitter-haskell is still not stable enough to depend on for other packages and is still a WIP.

@rewinfrey Apart from the IntelliJ's Haskell-plugin (the grammar of which is kind of a 'monster' I can imagine) and maybe some internal Yi-Editor parsing-code, tree-sitter-haskell is to my knowledge the only available incremental Haskell parser available. It would be a very sad situation, if this has to stop with unresolvable issues I am curious about the status of tree-sitter-haskell... are these issues resolvable in your opinion ?

tek commented 3 years ago

this applied to the version from before the rewrite, cannot reproduce it now.