Activate the tagmatch selection with javascript on a tag

I am trying to activate the tagmatch on a specific tag completely in javascript (or JQuery).

I can correctly select the node on the editor using xpath for
<span class="cm-string">"uniqueID-a"</span>
but I am not clear on how to click it or activate the tag matching.

I tried click(), focus(), etc. Is there something I am missing or a function in matchtags.js that makes more sense to pass this node to?

function selectNode(node) {; // fails

(CodeMirror 5)

Tag matching works on cursor position, so I don’t think the DOM node is really necessary here. Could you be a bit clearer about what you are trying to do?

I am trying to highlight specific tags in the code editor from other buttons and events on my page. I also modified the matchtag function to set off other actions for my application.

I know the xpath style search is probably not the best way to do things, but it’s an internal tool and ok if it breaks sometimes. All elements will have unique ids as well which makes it easy.

I don’t suppose I could potentially feed the doMatchTags function a line number or a range of text? I don’t fully understand the inputs and perhaps my method is too hacky.

For anyone else, didn’t realize there is a setCursor function

codeMirrorInstance.getDoc().setCursor({line: x, ch: x, sticky: 'after'});