-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(dart) - add highlighting for class and function names #4169
Open
guuido
wants to merge
7
commits into
highlightjs:main
Choose a base branch
from
guuido:fix/4091
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+71
−1
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
479434a
fix(dart): add class and function names highlighting
guuido ed3b936
update change log
guuido c726e93
fix(dart): remove multi-matcher from FUNCTION_REFERENCE
guuido 1f1a76a
Merge branch 'main' into fix/4091
guuido ea46b1f
(dart) add title.class scope to built-in classes
guuido fc13af4
Merge branch 'main' into fix/4091
guuido 3677adb
Merge branch 'main' into fix/4091
guuido File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Person</span> </span>{ | ||
<span class="hljs-built_in">String</span> name; | ||
<span class="hljs-built_in">int</span> age; | ||
|
||
<span class="hljs-title class_">Person</span>(<span class="hljs-keyword">this</span>.name, <span class="hljs-keyword">this</span>.age); | ||
|
||
<span class="hljs-keyword">void</span> <span class="hljs-title function_">introduce</span>() { | ||
<span class="hljs-title function_">print</span>(<span class="hljs-string">'My name is <span class="hljs-subst">$name</span> and I am <span class="hljs-subst">$age</span> years old.'</span>); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Person { | ||
String name; | ||
int age; | ||
|
||
Person(this.name, this.age); | ||
|
||
void introduce() { | ||
print('My name is $name and I am $age years old.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<span class="hljs-keyword">void</span> <span class="hljs-title function_">greet</span>(<span class="hljs-built_in">String</span> name) { | ||
<span class="hljs-title function_">print</span>(<span class="hljs-string">'Hello, <span class="hljs-subst">$name</span>!'</span>); | ||
} | ||
|
||
<span class="hljs-keyword">void</span> <span class="hljs-title function_">dummy</span>(<span class="hljs-title class_">Foo</span> obj) { | ||
<span class="hljs-keyword">return</span> obj; | ||
} | ||
|
||
<span class="hljs-built_in">int</span> <span class="hljs-title function_">add</span>(<span class="hljs-built_in">int</span> a, <span class="hljs-built_in">int</span> b) { | ||
<span class="hljs-keyword">return</span> a + b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
void greet(String name) { | ||
print('Hello, $name!'); | ||
} | ||
|
||
void dummy(Foo obj) { | ||
return obj; | ||
} | ||
|
||
int add(int a, int b) { | ||
return a + b; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why skip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't a built-in class also get
title.class
? That or perhapsbuilt_in
I'd think...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using this snippet as an example:
Currently the library already marks String as
built_in
, so I added this regex to prevent String from being matched astitle.class
. I may have misunderstood what skip is used for (still learning how the library works) - I setskip: true
because otherwise String wasn't decorated at all. I thought we wanted to preserve the current behavior, but if it's ok to usetitle.class
for built-in classes I can remove this partThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense.
I think you can skip the
skip
though... does it work without it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, without the
skip
String is not decorated at all. I've already removed this part because I understood it was ok to mark String withtitle.class
, but if you want I can add it again