texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.83k stars 345 forks source link

issue with keyval completion and open bracket #3159

Open mbertucci47 opened 1 year ago

mbertucci47 commented 1 year ago

Environment

Expected behavior

Once one selects a keyval with "Enter" or by clicking it, the completer should not pop back up with the keyval list.

Actual behavior

If the argument is not closed, the keyval list pops up. Consider

pic1

Once you select the keyval, the completion list should disappear because the user needs to fill the "val" of the "keyval". However after selecting the keyval it just pops back up:

pic2

The issue does not occur if the argument is closed, meaning starting with \begin{tikzcd}[fon]. The same behavior is observed regardless of the delimiter, e.g. \tikzcdset{fon shows the same issue.

This is relevant for users like me who don't have the completer turned on by default (so closing delimiters are not added automatically) but do often activate the keyval completion manually with Ctrl+Space.

How to reproduce

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[fon

\end{tikzcd}
\end{document}

Insert cursor after fon and follow steps above.

sunderme commented 1 year ago

Have you disabled "placeholders", because here no pop-up. Instead:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

    \begin{tikzcd}[font=|font commands

    \end{tikzcd}
\end{document}

| for cursor.

mbertucci47 commented 1 year ago

It seems the option you're talking about is "Insert arguments" which does fix it - there is also an "Arguments as placeholders" option; it seems to have no effect on this and I don't know what it does in general.

I'm not a fan of the placeholders but no worries if you don't think this is worth fixing for users with placeholders disabled.

mbertucci47 commented 1 year ago

Actually from the documentation it would seem "Arguments as placeholders" should be the option which controls the placeholder feature. But I just double checked and it's "Insert arguments" that determines whether or not a placeholder is created. Is this intended behavior?

Edit: Sorry, I think I get the options now. One thing that still confuses me is "Arguments as placeholders" seems to have no effect without "Insert arguments". For example one might expect that using the former without the latter would mean \frac{}{} has empty placeholders in each arg that you can move between with Ctrl + -> etc., but this is not the case.

sunderme commented 1 year ago

Probably you need some text for the placeholders for them to work.

sunderme commented 1 year ago

I have fixed some problems around this issue, but the actual problem is the "unlosed" square bracket. Usually when using the completer, brackets always appear in pairs and there is no issue.

mbertucci47 commented 1 year ago

Thanks! Right, I admit I'm a somewhat odd user in wanting keyval completion without using command completion much. I'll test the new build

mbertucci47 commented 1 year ago

As far as I can tell the behavior is the same as before, though perhaps that's what you meant by

the actual problem is the "unlosed" square bracket

sunderme commented 1 year ago

yes, I can't fix the issue of the "unclosed" bracket easily, hence the remark.