Open
Conversation
…ltering based on file open/close state. Remove applyTo property from tasks/problem-matchers
…ror collection data, as it is now in sync with markerService facade
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @rzhao271Matched files:
|
n-gist
commented
Feb 13, 2026
Comment on lines
+161
to
+162
| private readonly _facade = new DoubleResourceMap<IOriginMarkers>(); | ||
| private readonly _backyard = new DoubleResourceMap<Map<IMarkerOrigin, IOriginMarkers>>(); |
Contributor
Author
There was a problem hiding this comment.
Now I see no reason to have these separated, this may be combined to
private readonly _data = new DoubleResourceMap<{
facade: IOriginMarkers;
readonly all: Map<IMarkerOrigin, IOriginMarkers>
}>();This should simplify markers updating a bit, and just adds a property access during read
Keeping it as is for now to not mess initial reviews
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR aims to improve
markerServiceinternal management by adding a third dimension,origin, to the existing 'resource' andownerdimensionsissue, source of intention #291739 (comment)
Currently, some marker providers and consumers have to use complex logic for updating/reading markers
For example, problem matchers update markers based on textModel open/close state for the given URI: AbstractProblemCollector.shouldApplyMatch(). When textModel is closed,
problemCollectorsresend markers, assuming that markerServer storage for the given text model may have been under the control of another marker providerAnother example is how
MainThreadDiagnosticshas to read markers and push them back filtered on MainThreadDiagnostics.dispose(), actually manipulating markers that do not belong to itA specific case is when a document is opened by EH:
window.openTextDocumentAPI and closed - textModel not disposed immediately, resulting in not actual diagnostics information inmarkerServiceandProblems Vieworigin goals
origindimension in markerService storage intends to achieve1. Allow marker providers to push their updates without worrying about other providers activity
2. As a result, always up-to-date markers storage
3. Ability to change the currently active 'origin' without delays or performance impact
4. Give language extensions an option to switch from
onDidOpen/CloseTextDocumentevents that are tied with textDocument instantiation/disposal, totabGroupsevents, to make diagnostic information responsive based on the file editing state in UI5. Makes it possible to resolve potential collisions when more than one extension declares itself a provider of similar markers
provisions of changes of MarkerService
origindimension is added toMarkerService._data, which is renamed to_backyardand is still main storage of markers_facadestorage is added for maintaining an active slice of_backyard, a cache forMarkerService.readperformance, and represents a visible from the outside collection of markers'origin' property is removed from marker objects and added as argument to markerService methods
originisstring | undefined, representing two priority levels, whereundefinedis the lowest, and anystrings are treated equally prioritized over undefined. At the moment,stringis used only by MainThreadDiagnostics.extHostId. This does not resolve 'extension vs extension' yet but is sufficient for 'extension vs task problem-matcher' collision_facadeorigins switching is automatic and based onoriginsof incoming markers. Main mechanics are concentrated in new_updateOriginForOwnerResource()and_removeOriginForOwnerResource()methods, which are good review starting points_onMarkerChangedis fired for facade changes onlyproblemCollectorsandmainThreadDiagnosticsupdates simplified'applyTo' property of problem-matchers removed since the only reason for its existence seemed to be to help problem matchers avoid collisions with extensions
unclear points
After these changes, marker updates from extensions land in two ExtHostDiagnostics._collections, the one that belongs to the extension, and the second is
_mirrorCollection. This results in double sets of markers given away bygetDiagnostics(). In theory, this means that the language extension collection should not be included inExtHostDiagnostics._collections, so that it doesn't participate ingetDiagnostics()output. However, there is currently no option to filter spawned collections by this criterion. Therefore, the opposite is done — only_mirrorCollectionis included in the output, which could be correct since, after all changes,_mirrorCollectionbecame an always up-to-date reflection ofMarkerService._facade. So this requires someone with a more knowledgeable perspective. This is either the incorrect solution, since other collections are also excluded from thegetDiagnostics()output. Or, if the contents of these excluded collections are reflected inmarkerService, this location can be simplified even further. This would be logical, since otherwisegetDiagnostics()output is richer thanmarkerServicecontentstatements
When implementing automatic switching of the active 'origin', it is necessary to ensure that marker providers are aware of the use of
MarkerService.changeOne(..., markerData: IMarkerData[] | null). Passingnullremovesoriginand its markers, and this may result in another origin being placed at the facade. For example, when there is a task problem matcher is running, and a file is opened for editing, the extension origin becomes active. If the extension sendsnullwhen all problems are fixed, origin is removed, and markerService will place problem-matcher diagnostics to the facade. Marker providers such as language extensions should send[]for the case of absent problems to retain origin activity and sendnullor callMarkerService.removeOriginForOwneron dispose. However, such cases should be immediately visibletest kit
In already normal working scenarios there should be no noticeable changes except the removed delay between disappearing diagnostics on textModel removal and replacement by problem matcher diagnostics
show
Check videos for the difference demonstration. Pay attention to the 'unused' problem in Problems View. When it is Error, origin is problem-matcher. When it is a Warning, origin is the extension
Before the changes, replacement is delayed on file close:


After the changes, replacement is instant:
Looking further to leverage the results of markerService improvements, here is a branch for testing the switching of the
typescript-language-featuresextension from usingworkspace.onDidOpen/CloseTextDocumentevents, which results in an unsynced diagnostics state in case of closing files opened bywindow.openTextDocument()(resolution of #291739), towindow.tabGroupsevents https://github.com/n-gist/vscode/tree/markerService-origins-test-typescript-extension-switchToTabGroupsEventsApplying it over changes makes the behavior of opening .ts files from Explorer tab and by
workspace.openTextDocumentidentical. Though it is not complete and sometimes updates markers after the file is closed for some reason by DiagnosticsManager.scheduleDiagnosticsUpdate(), but it is a subject of a different PR, just mentioning it as noticedMy test project, containing .vsix extensions to test
workspace.openTextDocumentlate disposal issue andgetDiagnostics()outputs