Dmitry Gutov <dmitry@gutov.dev> writes:
I'm not sure, though, what is the big deal with adding the top-level
function's closing curly first thing before writing the body (after
that the parser starts working much better), so as far as I'm
concerned this patch is very optional. It does add some complexity,
after all.
I think this problem also affects languages without curly braces like
Ruby or Python.
Adding Alan and Joao, who were interested in this scenario as well.
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 981c7766375..9aaa8b32c73 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
Thanks for the patch. It works correctly and the existing c-ts-mode
tests pass. I suggest adding a test to prevent regressions:
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 5cdefe2122c..221b3d809af 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -464,3 +464,17 @@ main (void)
|
}
=-=-=
+
+Name: Empty Line (Block Start)
+
+=-=
+int
+main (void)
+{
+|
+=-=
+int
+main (void)
+{
+ |
+=-=-=