Skip to content

contextkey: fix scanner returning '>=' instead of '>' for greater-than operator#307059

Merged
ulugbekna merged 1 commit into
microsoft:mainfrom
xingsy97:wt/fix-contextkey-gt-lexeme
Apr 24, 2026
Merged

contextkey: fix scanner returning '>=' instead of '>' for greater-than operator#307059
ulugbekna merged 1 commit into
microsoft:mainfrom
xingsy97:wt/fix-contextkey-gt-lexeme

Conversation

@xingsy97
Copy link
Copy Markdown
Member

@xingsy97 xingsy97 commented Apr 1, 2026

Problem

Scanner.getLexeme() returns '>=' for both TokenType.Gt and TokenType.GtEq, making the two operators produce identical text. The Lt/LtEq pair correctly returns '<' and '<=' respectively, but the Gt case was set to '>=' instead of '>'.

Fix

Change the return value for TokenType.Gt from '>=' to '>'.

Copilot AI review requested due to automatic review settings April 1, 2026 08:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an incorrect lexeme mapping in the context key scanner so that TokenType.Gt reconstructs to > (distinct from TokenType.GtEq which is >=), improving correctness of error messages and any token-to-text reconstruction.

Changes:

  • Correct Scanner.getLexeme(TokenType.Gt) to return > instead of >=.

Comment thread src/vs/platform/contextkey/common/scanner.ts
@xingsy97 xingsy97 marked this pull request as draft April 1, 2026 08:59
@xingsy97 xingsy97 marked this pull request as ready for review April 1, 2026 09:00
@pwang347 pwang347 assigned ulugbekna and unassigned pwang347 Apr 22, 2026
Copy link
Copy Markdown
Contributor

@ulugbekna ulugbekna left a comment

Choose a reason for hiding this comment

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

good catch, and thank you for the PR!

@ulugbekna ulugbekna enabled auto-merge (squash) April 23, 2026 16:21
@ulugbekna ulugbekna closed this Apr 23, 2026
auto-merge was automatically disabled April 23, 2026 16:21

Pull request was closed

@ulugbekna ulugbekna reopened this Apr 23, 2026
@ulugbekna ulugbekna enabled auto-merge (squash) April 23, 2026 16:21
@ulugbekna ulugbekna merged commit c020167 into microsoft:main Apr 24, 2026
68 of 71 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 24, 2026
@xingsy97 xingsy97 deleted the wt/fix-contextkey-gt-lexeme branch April 27, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants