emacsorphanage / dart-mode

An Emacs mode for the Dart language
GNU General Public License v3.0
15 stars 2 forks source link

Fontify untyped parameters in anonymous functions #79

Closed bradyt closed 5 years ago

bradyt commented 5 years ago

The idiom chosen for current syntax highlighting, is that variables and parameters are only fontified (emacs term for syntax highlighting) the first time they are declared in scope. This convention is found in the cc-mode framework.

In the following example from https://www.dartlang.org/guides/language/language-tour#anonymous-functions, we intend that the first appearance of item is fontified as a declared variable, in particular, with the font-lock-variable-name-face face.

var list = ['apples', 'bananas', 'oranges'];
list.forEach((item) {
  print('${list.indexOf(item)}: $item');
});
bradyt commented 5 years ago

Fixed at https://github.com/bradyt/dart-mode/commit/e41f41e09cfeb35f3733f07c06ee8037825fb5ab.