Adding an access to selected item when validating a command

Use case or problem when running command palette, there is no way to know the id of the executed command proposed solution There is a way to know the selected item id, but it can change just hovering commands and no sure it has been run. So this is not enough to know the last selection before to do app.internalPlugins.getPluginById("command-palette").instance.modal.chooser.useSelectedItem(id) and then the modal is closed. So a property recording this will be useful

Edit: Ok I solved this adding event Listeners on click and enter, and that’s working with

    const chooser = ( as any).internalPlugins.getPluginById("command-palette").instance.modal.chooser
    const selectedItem = chooser.selectedItem
    const selectedId = chooser.values[selectedItem]? 

sometimes I’m not logical enough.
I added the click listener on

const modal = ( as any).internalPlugins.getPluginById("command-palette").instance.modal
const resultContainerEl = modal.resultContainerEl

I don’t need to delete it
and the keyboard listener on document. I delete it and the end of my operations

I added an edit in the description. That’s solved.