microsoft / microsoft/monaco-editor

[Feature Request] Add configurable option for marker/decoration limit (currently hardcoded at 500)

Open
#5,176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Context
  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)
Description

The Problem

I'm hitting the hardcoded 500 decoration limit when validating OpenAPI specs. I know #4744 and #2042 discussed this, and the reasoning was that 500+ errors usually means one error causing a cascade. That makes sense for typical code editing, but doesn't fit all use cases.

My Use Case

I'm building an OpenAPI validator that checks 10,000+ line specs against multiple rules:

  • Schema validation
  • Security configurations
  • Documentation completeness
  • Best practices

This produces 1,500+ independent issues that aren't related to each other - like missing descriptions on line 245, wrong parameter type on line 1,892, deprecated fields on line 8,134, etc. These are all legitimate, separate problems that need fixing.

Right now only the first 500 get squiggles, so issues stop showing visually around line 3,261 even though there are hundreds more throughout the file.

Why This Matters

The hardcoded 500 limit doesn't work well for:

  • Large config files (JSON/YAML schema validation)
  • Comprehensive linting/validation tools
  • Static analysis on big files
  • Data validation against schemas

In these cases, 500+ errors doesn't mean one root problem - it means thorough analysis of a large file.

Proposed Solution

Make it configurable with a safe default:

interface IEditorOptions {
  maxMarkerDecorations?: number; // default: 500
}

This way:

  • Default stays at 500 (no breaking changes)
  • Users who need more can opt-in
  • Performance trade-off is user's choice

I've worked around this by prioritizing errors over warnings, but it's still hiding legitimate issues.

Implementation Idea

// Instead of:
const MAX_DECORATIONS = 500;

// Make it:
const maxDecorations = this._configuration.options.get(EditorOption.maxMarkerDecorations) ?? 500;

Could add a docs warning that increasing this may impact performance.


Related: #4744, #2042

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the hardcoded MAX_DECORATIONS value and the EditorOption/IEditorOptions configuration entry points, then review related issues #4744 and #2042. Done means the decoration limit remains 500 by default, can be configured by users, and includes the proposed performance warning in the relevant documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.