We can ignore the actual event from onMarkerChange - it's enough to know that the markers changed. A naive implementation - perfectly ok for what we need - will just query the file being edited for all of its markers and set those. Some pseudo code:

    workspace.onMarkerChange((_) => setMarkers(currentFile.getMarkers()));