Currently, when you select some text you can press (, [, { and even $ to surround that text in matching brackets or inline math with $. For example:
a + b = c -> press $ -> $a + b = c$
Idea is to have a similar behaviour when you select a text and then press \ to enter some LaTeX command. (Currently, pressing \ would replace the selected text)
Ideally, you should see the same drop-down menu as when you use \ with no text selected, and you could tab-complete the command. For example:
danger -> press \ -> start typing em, tab-complete to select \emph -> \emph{danger}
Tbh this is a very hard-to-implement feature. I'm always against the pattern in which each extension creates its own hook to monitor user input. Unfortunately this seems to be a must for the suggested feature. I'll keep investigating.
I'm always against the pattern in which each extension creates its own hook to monitor user input.
I thought the described behavior with $ is thanks to this extension, because that doesn't work in files other than .tex from what I could tell/try.
But I can see why \command{$selected} might be:
a very hard-to-implement feature
$ auto-pairing is contributed by this extension, but the implementation is by vscode's API instead of a hook. So the new auto command surrounding is a new task that may need some justification and work.
I was thinking of this issue for the past several minutes and changed my mind. This feature will be included. Soon (TM).
Soon (TM) on marketplace.

IIRC there's already an update today for bug fixes. So this one will be released tmr or so in order to be not too annoying 馃槤
Yes, today we've already got one update :)
No rush for this, whenever you feel it would be appropriate (and maybe to allow some time for some more polishing, or something :)).
Thank you for rethinking, changing your mind, and a very quick implementation!
@James-Yu After having highlighted some equation I'd like to have it surrounded by \( \). However, what I get is the string I chose prepended by \(\). It seems that it doesn't happen with other completions. I guess that this is somehow related to the strings $0 and $1 but it is not clear for me how to use this feature.
I'd like to have it surrounded by
\( \)
Try using $...$ syntax, it should work without problem - just select your equation and press $.
I was using that syntax given a ChkTex warning I had.
Sorry but how does this work exactly?
Sorry for commenting on an old issue again. I see that this works and it's great, but the command has to come from the list. Can we allow a command not from the list as well, and assume that it only has 1 argument (like footnotesize)?
Sorry for commenting on an old issue again. I see that this works and it's great, but the command has to come from the list. Can we allow a command not from the list as well, and assume that it only has 1 argument (like footnotesize)?
I'm lacking the same behaviour. I guess it is nice to have a list, but you can create your own commands, etc. and it would be perfect to have this (with multi-cursor enabled ;))
What do you have in mind exactly? What could be done is to wrap the selections with {...} and put a multi-cursor before the opening {. Would that make it?
What do you have in mind exactly? What could be done is to wrap the selections with
{...}and put a multi-cursor before the opening{. Would that make it?
I think that is ok. I give you some other options:
I suggest to continue the discussion in #1530.
Most helpful comment
I was thinking of this issue for the past several minutes and changed my mind. This feature will be included. Soon (TM).