nim-lang / nim-mode

An emacs major mode for the Nim programming language
138 stars 46 forks source link

Bug with flymake nimsuggest #183

Closed yuutayamada closed 6 years ago

yuutayamada commented 6 years ago

There is a freezing issue

template custom_elif(pred, body: untyped) =
  elif pred:
    body

on above code, when you type something and when nim-mode invoke chk option, the freezing started as far as I observed, but I still not fully understand this problem. Somehow adding nim-log function was solved the issue which is not quite understandable for me.

flymake-nimsuggest is currently kind of experimental thing in this repo please don't try

yuutayamada commented 6 years ago

I'm suspecting some code on nimsuggest--flymake-error-parser

below part was the freezing parts:

for (beg . end) = (funcall 'flymake-diag-region buffer line col)

and passing data was exactly same message twice.

Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 2 2 expression expected, but found 'keyword elif'
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 2 7 invalid indentation
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 3 4 undeclared identifier: 'Body'
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Hint 1 9 'custom_elif2' is declared but not used [XDeclaredButNotUsed]
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 2 2 expression expected, but found 'keyword elif'
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 2 7 invalid indentation
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Error 3 4 undeclared identifier: 'Body'
Debug (nim): flymake(parse1) /home/yy/code/nim/foo.nim Hint 1 9 'custom_elif2' is declared but not used [XDeclaredButNotUsed]
yuutayamada commented 6 years ago

apparently (end-of-thing 'sexp) or my nim-mode's implementation was cause of this problem.

you can check the end-of-thing function on elif's "e" (it freezes emacs)

yuutayamada commented 6 years ago

Added workaround