-
Notifications
You must be signed in to change notification settings - Fork 23
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
How to disable auto-formatting after inserting parentheses? #142
Comments
I'm surprised by your second example as I don't think Symex does any indentation in insert mode. Could you try disabling Symex and just enabling paredit-mode in your Typescript buffer? Is the behavior any different? Assuming the behavior is due to the use of paredit (which is used by Symex in insert mode), take a look at #84 as that is related and may resolve this issue when it's addressed. It also contains a link to a workaround, which should be slightly modified now -- this would replace the corresponding line in
Does that help? |
Sorry for the late response.
Yep, same behaviour, so looks like paredit does cause it. As you've suggested, I patched (defun symex-enter-mode ()
"Take necessary action upon symex mode entry."
(when (member major-mode (symex-get-lisp-modes)
(symex--ensure-minor-mode))
(symex--adjust-point-on-entry)
(when symex-remember-branch-positions-p
(symex--clear-branch-memory))
(symex-select-nearest)
(when symex-refocus-p
;; smooth scrolling currently not supported
;; may add it back in the future
(symex--set-scroll-margin))
(symex--enter-mode))) The behaviour didn't change. Is this what you meant? |
@anonimitoraf Yeah, that looks right! Did you close and reopen the buffer after making the change? Or restarting Emacs to be extra sure? The only places in the code I see
Lmk if those assumptions hold up or if there's something unexpected there. |
Hi @countvajhula, I'm a bit confused. I'd like to use I've noticed that:
Peek.2024-07-20.19-02.webm |
So there are two meanings of “mode” here. The variable “Symex-mode” refers to a _minor mode_ that affects insert mode/“state”, specifically parentheses, by directly using paredit functions. This minor mode does not do anything else. The other meaning of mode is the modal interface used to edit code, which does not affect insert mode operations. You can use the latter without the former, and in this case, that’s what you’d like to do.The above steps should give us a clue as to whether, in your typescript buffer, it is Symex minor mode that is active or if it is paredit that is active (unbeknownst to you). Depending on that, we can debug further.Sent from my iPhoneOn Jul 20, 2024, at 2:04 AM, Rafael Nicdao ***@***.***> wrote:
Hi @countvajhula, I'm a bit confused. I'd like to use symex for Typescript files, but just without the auto-format/auto-indent and without the extra spaces when adding parents.
I've noticed that:
paredit and symex disabled = no issue
paredit disabled and symex enabled = has issue
Peek 2024-07-20 19-02.webm
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks for explaining! What i've observed is: symex-mode causes the issue while paredit-mode is disabled. I'll check why symex-mode keeps getting activated for TS files and find a way to disable it then |
This seems to be better default behavior for tree-sitter buffers than maintaining the balancing behavior that's desirable in Lisp. Workaround (fix?) for #142.
Sounds good! For now, I've gone ahead and committed the workaround we discussed into the master branch, since it seems like we generally don't want paren balancing behavior in tree-sitter buffers. Please let me know if your investigation reveals any new information, or if the issue is resolved after upgrading. P.S. I also noticed there was a typo in the workaround in my previous comment -- it could be that that was the problem. Anyhow, please let me know either way, and thanks! |
Hi!
I've noticed (particular with Typescript) that symex does some auto-formatting when I parentheses while in
evil
INSERT mode.Screen.Recording.2024-07-01.at.11.05.05.AM.mov
To reproduce, insert parentheses after
partition
and afterf
in this snippet:Is there a way to completely disable formatting?
The text was updated successfully, but these errors were encountered: