Skip to content

Expose the score function in Monaco editor - #322959

Merged
Alexandru Dima (alexdima) merged 3 commits into
microsoft:mainfrom
remcohaszing:monaco-expose-score
Aug 28, 2026
Merged

Expose the score function in Monaco editor#322959
Alexandru Dima (alexdima) merged 3 commits into
microsoft:mainfrom
remcohaszing:monaco-expose-score

Conversation

@remcohaszing

Copy link
Copy Markdown
Contributor

The score function is useful for filtering models in Monaco editor. This is also useful in functionality outside of the core.

Example use cases are monaco-marker-data-provider, and a worker synchronization library I’m working on.

The `score` function is useful for filtering models in Monaco editor.
This is also useful in functionality outside of the core.
Copilot AI review requested due to automatic review settings June 25, 2026 15:02

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

This PR exposes the existing language-selector scoring helper as a public monaco.languages.score API, enabling external consumers to reuse Monaco’s built-in selector matching logic (e.g., for model filtering and worker synchronization scenarios).

Changes:

  • Export score on the monaco.languages API surface (runtime + typings).
  • Make candidateIsSynchronized default to true to support calls that omit the 4th argument.
  • Update the Monaco .d.ts generation recipe to include the new API.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/vs/monaco.d.ts Adds the monaco.languages.score type declaration to the public Monaco typings.
src/vs/editor/standalone/browser/standaloneLanguages.ts Wires score into the standalone Monaco languages API object.
src/vs/editor/common/languageSelector.ts Adjusts score parameter defaults/optionality to support the new public calling pattern.
build/monaco/monaco.d.ts.recipe Ensures score is included when generating monaco.d.ts.

Comment thread src/vs/editor/common/languageSelector.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@alexdima Alexandru Dima (alexdima) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@alexdima
Alexandru Dima (alexdima) merged commit abf2ad9 into microsoft:main Aug 28, 2026
27 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 28, 2026
@remcohaszing
Remco Haszing (remcohaszing) deleted the monaco-expose-score branch August 28, 2026 13:30
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.

4 participants