emacsorphanage / dart-mode

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

String interpolation breaks on quotes #94

Open bradyt opened 5 years ago

bradyt commented 5 years ago

In the following, dart-mode does not match the string interpolation at all, and the (s) is not fontified being contained in the string.

class ArgumentError extends Error {
  String get _errorName => "Invalid argument${!_hasValue ? "(s)" : ""}";
}
bradyt commented 5 years ago

I'm not sure why we are highlighting string interpolations as variables, since the idiom in place is to highlight variables when they are declared. But even if we disable the highlighting as variable, we have the bigger issue that nested strings are not fontified as strings. Fixing that should be a higher priority. We might next consider highlighting string interpolation as if it was code, not in a string. Though, this might be a challenging recursion situation, with nested string interpolations.

bradyt commented 5 years ago

nix-mode seems to have some logic for recursive string interpolation that we could use. I think the essential idea is they are adding properties to the text to track interpolation state.