Search code examples
monaco-editorvisual-studio-monaco

Variable transforms in snippets using tabstop number


I'm wondering if it's possible to use the tabstop integers as variables for transforms. In sublime transforms allow for the following behavior:

This is a ${1:simple} snippet

This snippet is ${1/complex/not/} for beginners

Expected behavior would be that anything but complex prints This snippet is for beginners (when complex is entered is should print This snippet is not for beginners)

I tried in my custom version of Monaco and haven't managed to get it working but I've noticed that the documentation doesn't explicitly names this as a feature.

Has anyone managed to get this working? If so I'll update this question with more specifics about my setup.

Thanks


Solution

  • Placeholder tranformations aren't supported yet, only variable (eg ${TM_SELECTED_TEXT/match/replacement/}. The issue in the Visual Studio Code repo that tracks this is here:

    Snippet transformations for placeholders #34683