Skip to content

Invalidate Markdown code block editor providers - #329636

Draft
Henning Dieterichs (hediet) wants to merge 1 commit into
mainfrom
hediet/b/markdown-code-block-editor-invalidation
Draft

Invalidate Markdown code block editor providers#329636
Henning Dieterichs (hediet) wants to merge 1 commit into
mainfrom
hediet/b/markdown-code-block-editor-invalidation

Conversation

@hediet

Copy link
Copy Markdown
Member

Summary

  • remove provider-defined descriptor cache keys and cache resolutions by provider, Markdown document URI, and complete fenced-code info string
  • add a required onDidChange event so dynamic providers can invalidate resolved descriptors when settings or resources change
  • rename the resolver request field from language to infoString
  • add an extension authoring guide covering static and dynamic contributions, API V1, invalidation, self-contained browser bundles, and @vscode/web-editors

Dependency

Depends on microsoft/vscode-packages#231, which preserves the complete fenced info string separately from the language token and passes it to embedded editor providers. The Markdown editor dependency must be updated after that package change is published.

Testing

Not run per request. git diff --check passes in both repositories.

Cache dynamic editor descriptors by provider, document, and complete fence info string, and let providers invalidate resolutions through onDidChange. Add an extension authoring guide covering the manifest API and @vscode/web-editors guest integration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52d9b18a-7144-4b00-9fe2-d2672f2a5e12
Copilot AI balanced review requested due to automatic review settings August 7, 2026 16:45
@hediet
Henning Dieterichs (hediet) marked this pull request as ready for review August 7, 2026 16:47
@hediet
Henning Dieterichs (hediet) marked this pull request as draft August 7, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Markdown embedded code editor caching and invalidation, alongside extension author documentation.

Changes:

  • Caches descriptors by provider, document URI, and complete info string.
  • Adds provider-driven invalidation through onDidChange.
  • Documents static and dynamic editor contributions.
Show a summary per file
File Description
markdownEditorProvider.ts Implements caching, invalidation, and updated provider API.
package.schema.json Clarifies selector language semantics.
editor.ts Passes info strings in resolver messages.
markdown-code-block-editor-extensions.md Adds extension authoring guidance.
CONTRIBUTING.md Links the new guide.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 4
  • Review effort level: Balanced

provider.source.kind === 'static' && resourceKeys.includes(provider.source.resource.toString()));
if (dynamicResourceChanged || staticResourceChanged) {
void refreshCodeBlockEditorProviders(false, dynamicResourceChanged);
this.#clearResolvedCodeBlockEditorCaches();
function isMarkdownCodeBlockEditorProviderApi(value: unknown): value is MarkdownCodeBlockEditorProviderApi {
return typeof value === 'object'
&& value !== null
&& typeof (value as Record<string, unknown>).onDidChange === 'function'
</style>
</head>
<body>
<textarea id="value"></textarea>
resolve: definition.source.kind === 'static'
? async () => definition.source.kind === 'static' ? definition.source.descriptor : undefined
: language => this.#resolveCodeBlockEditor(definition.id, language),
: infoString => this.#resolveCodeBlockEditor(definition.id, infoString),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants