dart-atom / dart

A Dart plugin for Atom.
http://dart-atom.github.io/dart/
BSD 3-Clause "New" or "Revised" License
154 stars 44 forks source link

functions with type arguments don't highlight correctly #1181

Closed DanTup closed 5 years ago

DanTup commented 5 years ago

I don't have Atom to verify this, but it came up in Dart Code:

main() {}

void func1() {
  func2<String>();
}

void func2<T>() {
  func1();
}

Here, func1 and func2 were highlighted differently because the regex that highlights functions expects either ( or \s=> immediately after the name. I've fixed it by also allowing <:

https://github.com/Dart-Code/Dart-Code/commit/6394cf3214c9cb1567548d533dc1be32cc07deea

Before: screenshot 2019-01-15 at 1 47 20 pm

After: screenshot 2019-01-15 at 1 46 56 pm

The only slight niggle is that if you type a < immediately after some text (without whitespace) it'll also trigger (for ex if (a<10) but we can't easily fix that with regex.

devoncarew commented 5 years ago

Awesome, thanks for the report (and the indicated fix).