microsoft / microsoft/monaco-editor

[Feature Request] Semantic highlighting for TypeScript/JavaScript

Open
#2,872 4 comments 37 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request typescript
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

This feature was already implemented in vscode, and it's built on top of the same TypeScript compiler that monaco uses, so from what I can tell it should just be possible to port the same code over to monaco-typescript.

I understand the Typescript worker's semantic tokens provider is not the most efficient implementation. I also understand its visual impact when used on top of Monarch will be more disruptive than on top of Textmate, at least for very large files. Yet, the pros clearly outweigh the cons.

If implemented, it could still be marked as experimental and disabled by default. It could also come with a more declarative option for when it should be enabled, e.g max number of characters, and/or max number of lines. The debounce time should also be configurable. When working on small snippets, there's no harm in running it more often.

The Monarch grammars for TS/JS leave a lot to be desired. Semantic highlighting would be a huge step forward.

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 comparing VS Code's semantic highlighting implementation with the monaco-typescript TypeScript worker, focusing on how semantic tokens are provided over Monarch highlighting. Define the integration and configuration points for experimental, opt-in behavior, character or line limits, and debounce timing. Done means TypeScript and JavaScript semantic highlighting works without being enabled by default.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.