Hi, I’m currently developing a VSCode extension that opens model-explorer in an integrated webview panel.
The extension includes a command that highlights the node corresponding to the currently selected line of code.
Here’s the relevant code section:
focusOnNode() {
if (!this.editor || !this.nodeMap) {
return;
}
const selection = this.editor.selection;
if (selection.isEmpty) {
return;
}
this.panel.webview.postMessage({
'cmd': 'model-explorer-select-node-by-node-id',
'nodeId': this.nodeMap.getFirstNodeIDByLine(String(selection.start.line))
});
// Bring the focus on the webview panel.
this.panel.reveal();
}
This implementation is adapted from iree-experimental, where model-explorer integration was already working.
Currently, the command only supports highlighting a single node at a time.
However, I would like to modify it so that when a user selects multiple lines in the editor, the corresponding multiple nodes in model-explorer are highlighted. This is the command responsible for the highlighting: Listen to postMessage
Since #261 , there exists support for highlighting multiple nodes (at least in the sync view).
I’ve looked through the repository but couldn’t find a documented way to trigger multiple-node highlighting via postMessage.
So I wanted to ask, if there is already a mechanism or message command for highlighting multiple nodes at once (e.g., an equivalent of 'model-explorer-select-node-by-node-id' that accepts multiple IDs)? If not, would it be possible to extend the existing command to accept an array of node IDs?
Additionally, is there (or could there be) a way to switch between different graphs via postMessage? I ask about it, because I planned for the extension to visualize all files in a folder as different graphs in the same web view panel and would like to switch between the graphs, if the user has switched between the files inside the folder, for a smoother integration.
Hi, I’m currently developing a VSCode extension that opens model-explorer in an integrated webview panel.
The extension includes a command that highlights the node corresponding to the currently selected line of code.
Here’s the relevant code section:
This implementation is adapted from iree-experimental, where model-explorer integration was already working.
Currently, the command only supports highlighting a single node at a time.
However, I would like to modify it so that when a user selects multiple lines in the editor, the corresponding multiple nodes in model-explorer are highlighted. This is the command responsible for the highlighting: Listen to postMessage
Since #261 , there exists support for highlighting multiple nodes (at least in the sync view).
I’ve looked through the repository but couldn’t find a documented way to trigger multiple-node highlighting via postMessage.
So I wanted to ask, if there is already a mechanism or message command for highlighting multiple nodes at once (e.g., an equivalent of 'model-explorer-select-node-by-node-id' that accepts multiple IDs)? If not, would it be possible to extend the existing command to accept an array of node IDs?
Additionally, is there (or could there be) a way to switch between different graphs via postMessage? I ask about it, because I planned for the extension to visualize all files in a folder as different graphs in the same web view panel and would like to switch between the graphs, if the user has switched between the files inside the folder, for a smoother integration.