microsoft / microsoft/TypeScript-TmLanguage

Specific JS construct breaks syntax highlighting

Open
#988 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.81.0 / 6445d93c81ebe42c4cbd7a60712e0b17d9463e97
  • OS Version: Windows_NT x64 10.0.19045

Snippet:

function one() {
	return (
		{
			toString: () => {
				return "Something";
			}
		}
	);
}

function two() {
	return "??";
}

Screenshot:
image

Steps to Reproduce:

  1. Paste the following into a fresh file with JavaScript set as a language
  2. Observe keyword highlighting not working correctly for any functions following function one

This specific nesting (a lambda function with a block inside a property of an object inside parenthesis in a return statement) triggers the effect.

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

Reproduce the issue in a fresh JavaScript file using the provided snippet and confirm that highlighting after function one is incorrect. Then inspect the TypeScript-TmLanguage grammar files for handling of nested object properties, arrow functions, and return statements; done means later functions receive correct keyword highlighting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.