Is it possible to add a Widget Decoration instead of text while selecting a variable from auto complete?

So my use case is; whenever user selects any value from autocomplete dialog, instead of normal text I want it to replace with an Inline Widget that can be clicked to open a modal…
So I was wondering if this can be achieved using Completion object’s apply field?

 apply: (
                  view: EditorView,
                  completion: MyCompletion,
                  from: number,
                  to: number
                ) => {
                  // code here...

If yes? can you please tell me how to achieve this as I’m really new to the Codemirror

Yes. But you’re going to have to learn the library, since I don’t expect anyone on this forum is going to implement your feature for you. Roughly, you’d want to set up an extension that manages these widget decorations, and dispatch a transaction (probably with a custom effect attached) that creates the widget. See the decoration example.