Closed bradyt closed 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.
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 likeint n = 2 / 3;
treat characters starting from/
fontify as a comment. By itself,/
should have symbol syntax.electric-indent-chars
expression is cleaner withsetq-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 leavevar
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
andc
, invar 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 usefont-lock
'sMATCHER
andANCHORED-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.