flutter / flutter/devtools

Syntax highlighting improvements

Open
#5,821 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2 screen: debugger
Dominant language
Dart
Stars
1.7k
Forks
404
Avg merge
6d 17h
Merged PRs (30d)
18

Description

A couple things I noticed while updating some debugger panel tests:

  1. If there is no grammar, the SyntaxHighlighter returns a TextSpan with no children. This is a problem because in CodeView (the only place where our SyntaxHighlighter is used, we expect the TextSpan to have children, and we loop through the children to break the span into lines. Therefore, if there is no grammar, we display the entire script on a single line.
  2. We loop through the entire source twice. Once to add the syntax highlighting, and then again to break it into lines. We could see some performance improvements if we do both in one step (see https://github.com/flutter/devtools/issues/5703)

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 with SyntaxHighlighter and CodeView, the only stated consumer, then inspect the debugger panel tests mentioned in the issue. Verify behavior when no grammar is available and measure that syntax highlighting and line breaking are handled in one source pass, with the existing tests still passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.