TeXiFy-IDEA icon indicating copy to clipboard operation
TeXiFy-IDEA copied to clipboard

Disable automatic insertion of closing bracket when typing in front of text

Open proteusGIT opened this issue 1 year ago • 5 comments

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

Build #IU-231.8109.175, built on March 28, 2023

Operating System

Windows10

TeXiFy IDEA version

0.7.29 - 2023-04-14

What I did (steps to reproduce)

Given some text where I want to put something in brackets ( and ), after inserting the opening bracket (, the closing bracket ) is placed automatically behing the opening bracket.

Minimal example to reproduce the problem

\documentclass{article}
\begin{document}

some text [CURSOR]e.g. some example text continues;
\end{document}

now place brackets around e.g. some example by first pressing (.

Expected behavior

Only the opening bracket is inserted and the cursor moves behind the opening bracket.

Actual behavior

Also the closing bracket is created.

\documentclass{article}
\begin{document}

some text ()[CURSOR]e.g. some example text continues;

now place brackets around --e.g. some example--
    
\end{document}

ps: Is there a way to disable all autoinsertions? I only found the second $ symbol exception in the settings.

proteusGIT avatar Aug 08 '23 10:08 proteusGIT

Thanks for reporting this one, I agree, and noticed other plugins like Kotlin do work like this. So I think this should work for all of {([$ Note to self: in case of (<caret>) after typing backspace the closing parenthesis should disappear as well. For whatever reason this only works for $$ right now.

Is there a way to disable all autoinsertions?

Settings | Editor | General | Smart Keys | Insert paired brackets, I admit it's slightly hard to find, I'll add it to our own documentation.

PHPirates avatar Aug 08 '23 18:08 PHPirates

I guess it really depends on the 'language' (in a broad sense including english, Java, LaTeX, etc.) an what the default should be. For Java, I would rarely decide later on to wrap some part of my code in brackets. Much more often, I would type from left to right typing "(" and then parameters and then ")". However, also then---for me---")" may be easier to type at the end than "<Right>" to skip the autoinserted ")". For LaTeX, editing text much more often involves wrapping some text in "(" and ")" so the balance is different for LaTeX. Sure, I could imagine and learn a new key combination to first select a portion of text to add it in brackets but---to me---there are many other edit operations that would then also warrant such a key combination. For example, in MS Notepad, Wordpad, and Word, brackets are not automatically inserted. I would assume that they thought about it at least once but decided against it each time. Also in the textfield where I am entering text right now, this is not automatically added. Also, in IntelliJ, when editing Java code, the closing bracket is inserted automatically: unless (!) I am editing a string variable; inside the '"' and '"', closing brackets are not added. I guess that in text belonging to natural language, closing brackets should not be added automatically (likewise, closing brackets should not automatically produce opening brackets..). So in LaTeX, I would say that especially round brackets usually mean natural language; when typing "{", it appears---to me---reasonable to automatically add "}".

Afterall, I want to use an IDE to make editing simple. This may just mean that it should be just like in any other tool unless there is a very good reason against it.

proteusGIT avatar Aug 09 '23 09:08 proteusGIT

This may just mean that it should be just like in any other tool unless there is a very good reason against it.

Agree, so let's keep the automatic insertion of closing parenthesis and bracket on by default, since Markdown and Asciidoctor plugins do that as well.

PHPirates avatar Aug 09 '23 11:08 PHPirates

Ok :) you found tools where the closing brackets are inserted automatically apparently also where natural language text is to be written. Still, if there would be an option to change this default to make in work like in notepad++, notepad, wordpad, word, terminals, password fields, textfields on websites like github, etc. that would still be great imo.

proteusGIT avatar Aug 09 '23 17:08 proteusGIT

The option already exists, see the end of my first comment in this thread

PHPirates avatar Aug 09 '23 19:08 PHPirates