Fix ColorPresentation.is rejecting presentations with a textEdit - #1865
Merged
Dirk Bäumer (dbaeumer) merged 1 commit intoSep 28, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted fix is correct and covered by an appropriate regression test.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes ColorPresentation.is so presentations containing a valid textEdit are accepted.
Changes:
- Validates
candidate.textEditrather than the containing presentation. - Adds regression coverage for a presentation with an insert edit.
| File | Description |
|---|---|
types/src/main.ts |
Corrects textEdit validation. |
types/src/test/typeguards.test.ts |
Adds regression coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Dirk Bäumer (dbaeumer)
approved these changes
Sep 28, 2026
Dirk Bäumer (dbaeumer)
enabled auto-merge (squash)
September 28, 2026 16:22
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 28, 2026
Paul (pwang347)
approved these changes
Sep 28, 2026
Alexandre Kohler (kwy404)
added a commit
to kwy404/kwy404
that referenced
this pull request
Sep 28, 2026
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.
ColorPresentation.isvalidates the optionaltextEditby callingTextEdit.is(candidate)on the presentation itself instead of oncandidate.textEdit. A presentation has norangeornewText, so every valid presentation that carries atextEditis rejected. For exampleColorPresentation.is(ColorPresentation.create('red', TextEdit.insert(Position.create(0, 0), 'red')))returnsfalse.The fix passes
candidate.textEdittoTextEdit.is.I added a
ColorPresentation.iscase totypes/src/test/typeguards.test.ts. It fails before the change (false !== true) and passes after it. The full types test suite (39 tests) passes and eslint is clean.