Description
I haven't had a chance to isolate it, but I ran across a case where indentation would hang when trying to indent parameters in a function. It turns out that the function before that one had unbalanced parentheses (one too many close parens). The behavior was that typescript--backward-to-parameter-list
got stuck in one place and never made progress.
A quick fix would be at least to verify that we're making progress in that loop.
The actual case looked something like this:
function1(): void {
blah = baz(foo)); // <--- note extra closing paren
}
function2(
param1: thing, // <--- go to start of line, hit TAB, emacs hangs.
): void {
whatever;
}
I did some quick-and-dirty instrumenting (see the now-commented-out message
invocation at the top of the cl-loop
):
(defun typescript--backward-to-parameter-list ()
"..."
(let ((location
(or
;; This handles the case of a function with return type annotation.
(save-excursion
(cl-loop named search-loop
do
;; (message "top of loop, point=%d" (point))
(typescript--backward-syntactic-ws)
;; Check whether we are at "):".
(when (and (eq (char-before) ?\:)
That yielded the following messages, which I've annotated with comments:
;;; compile my modified function, get...
typescript--backward-to-parameter-list
;;; hit TAB; emacs hangs after a few times through the loop
;;; (Note the "5435 times"...)
top of loop, point=6894
top of loop, point=6882
top of loop, point=6873
top of loop, point=6867
top of loop, point=6637 [5435 times]
;;; I hit C-g and see what I can figure out.
Entering debugger...
Hopefully this is enough to give someone a hint on where to start looking. If this is drawing a blank with everyone else, I'll see if I can't put together a repro.
Thanks for the great mode!
I'm using typescript-mode from ELPA:
typescript-mode 0.3 installed Major mode for editing typescript