emacsorphanage / dart-mode

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

Remove cc #59

Closed bradyt closed 6 years ago

bradyt commented 6 years ago

A few minor fixes, a little improvement in indent line function, and more fontification.

There was a misunderstanding in how we call modify-syntax-entry for // comments, we should have used _ 12, not < 12. The latter made lines like int n = 2 / 3; treat characters starting from / fontify as a comment. By itself, / should have symbol syntax.

electric-indent-chars expression is cleaner with setq-local. Replaced for example ?\) with ?\x28, hex representation, to avoid errors in evaluating buffer as elisp.

Indentation is slightly improved. It is now relative to previous line, rather than a calculation absolute to buffer. And it handle lines with multiple characters of paren syntax. I have some thoughts about challenges and directions for improving indentation function further, but don't want to bog down this particular message.

The names of font-lock variables were simplified.

We made decisions in fontification, like dynamic is now fontified as a type, since for example it can appear in a parameterized type. We leave var highlighted as a keyword.

Fontification of numbers and hex numbers as constants, now has a regex that should match what ECMA 408 specifies. We chose not to fontify the unary operator - preceding numbers.

Fontification of functions seems relatively straightforward.

Fontification of variables is more difficult.

The first of two commits for these, fontifies whenever an appropriate lower camel case identifier is appropriately preceded by final, const, var, or a type.

The second of these two commits handles the identifiers that follow, like b and c, in var a, b, c;.

I noticed in the Known bugs section at top of source file, that we should also highlight undeclared formal parameters. This makes sense, this will always still be the first place a variable will appear in a scope, if I'm using the term "scope" in a way that makes sense. Maybe this won't be too hard, we could use font-lock's MATCHER and ANCHORED-MATCHER, several times, to first fontify all positional formal parameters, then fontify named and optional formal parameters. Or something similar. But maybe fontification can be considered usable for now.

Another issue in fontification, we might be able to fix multiline strings (and unescaped quote symbols, as described in issue https://github.com/nex3/dart-mode/issues/31) and raw strings, and perhaps other comment delimiters.

bradyt commented 6 years ago

Hmm, seems I need to study Github, pull requests, etc.

EDIT: The first try at a pull request here, was showing a conflict. Seems your repo has a squash of three commits, whereas my repo had those three commits, and the latter is where these commits were originally rooted. I rebased onto your repo's squashed commit, and the pull request commits seems to appear with no conflicts now.