Adding inline widget in monaco editor

Viewed 227

I am developing an expression editor using the Monaco editor. I want to be able to insert "tokens" for function parameters. Something similar to this UI from Google DataStudio:

Google datastudio field editor

As in the above example, if the user types in the following expression:

LENGTH(CONCAT({Country Code}, {Country Name}, "some text"))

Both {Country Code} and {Country Name} are tokens that they can insert. Users cannot edit or partially delete the tokens. They can only fully delete them. Ideally I would like to show a tooltip when someone hovers over the token, so that I can display the full name and data type.

I looked into ContentWidget, but it is only displayed above a line/position. I need the "token" to be inline with the expression (as in you can use a token in place of a parameter).

I couldn't find any reference to implementing this. Appreciate any help or guidance.

0 Answers
Related