microsoft / microsoft/TypeScript-TmLanguage

Javascript highlighting fails when less than symbol ("<") is first char and followed by greater than (">")

Open
#884 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Accepting PRs bug javascript
Dominant language
TypeScript
Stars
471
Forks
149
PR merge metrics
No merged PRs in 30d

Description

TS and JS Grammar Extension version: clicking previous link (in chrome 91.0.4472.114 on macos 10.13.6) gives 404 but searching vscode 1.59.1 extensions for @builtin typescript shows vscode.typescript-language-features 1.0.0 and vscode.typescript 1.0.0. Installing ms-vscode.vscode-typescript-next 4.5.20210902, found in this repo's readme, made no difference.

Code

vscode language mode: JavaScript

const x = 1;
0
< x
&& 1 > 0 // incorrect syntax highlight color coding

Screen Shot 2021-09-03 at 17 54 05

The issue seems to be that < x … > is interpreted as some type specification (like in array<int>)?
Compare with following where the last x is replaced with 1.

const x = 1;
0
< 1
&& 1 > 0 // correct syntax highlight color coding

Screen Shot 2021-09-03 at 17 55 02


I found #752 but decided to open a new issue.

Contributor guide

No contributing guide indexed for this repository

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 with the JavaScript grammar behavior for the reproduced < x and && 1 > 0 expression, then compare it with the numeric variant in the issue. Review the related #752 issue and the grammar files in this repository to identify the relevant rule. Done means both examples receive correct JavaScript syntax highlighting.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.