Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Dart) Highlight colors for Class and Constructor Calls #4091

Open
Husseink-hagag opened this issue Aug 13, 2024 · 4 comments · May be fixed by #4169
Open

(Dart) Highlight colors for Class and Constructor Calls #4091

Husseink-hagag opened this issue Aug 13, 2024 · 4 comments · May be fixed by #4169
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language

Comments

@Husseink-hagag
Copy link

Husseink-hagag commented Aug 13, 2024

Describe the issue

The current output lacks color for class names and constructor calls so most lines are displayed in the same color, which significantly impacts readability and makes it challenging to distinguish between different code components. In contrast

Which language seems to have the issue?

Dart (the issue is impacting Flutter)

Are you using highlight or highlightAuto?

highlight

...

Sample Code to Reproduce

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold (
      appBar: AppBar(
        title: const Text('Scaffold Example'),
      ),
      body: const Center(
        child: Text('Hello, World!'),
      ),
      drawer: Drawer(
        child: ListView(
          children: const <Widget>[
            ListTile(title: Text('Home')),
            ListTile(title: Text('Profile')),
          ],
        ),
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
          BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: Icon(Icons.add),
      ),
    ),
  ));
}

Expected behavior
Highlight colors for Class and Constructor Calls

Additional context

Here are two images:
(1) - displaying the current output from the Highlight library , where all elements appear in the same color, making it difficult to read.
(2) - a different library, which shows custom colors for classes and constructors. Both images feature code written in Dart for Flutter.

highlight

other

@Husseink-hagag Husseink-hagag added bug help welcome Could use help from community language labels Aug 13, 2024
@joshgoebel
Copy link
Member

I don't see a lot of "patterns" to go off of here (to find a specific constructor, etc), but it'd probably be easy to improve "attribute" (or attr, I always forget) like child: and if CamelCaseClasses is syntax or idiomatic Dart then we could probably just have a general rule for those - regardless of where they are in the grammar.

Are you interesting in working on a PR for this?

@joshgoebel joshgoebel added the good first issue Should be easier for first time contributors label Sep 23, 2024
@reenakp2601
Copy link

@Husseink-hagag can you tell me a bit more about this issue, like if you tried to look into the repository or made any progress. Since I was reading the docs of this repo from past few days, I want to contribute to this issue, @joshgoebel can you please assign me this.

@joshgoebel
Copy link
Member

We don't have that many people vying to complete issues - if you want to work on it, just do it and submit a PR and we're happy to look at it.

So Dart's convention seems to be PascalCase, which is very similar as say Ruby, Wren, etc... so I think we could start by copying the CLASS_NAME_RE and CLASS_NAME_REFERENCE right out of Ruby and then see how that looks.

@guuido
Copy link
Contributor

guuido commented Nov 7, 2024

@reenakp2601 are you still working on this? If you're planning to submit a fix I'll leave it to you, otherwise I can take it over

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Should be easier for first time contributors help welcome Could use help from community language
Projects
None yet
4 participants