Closed cpitclaudel closed 7 years ago
One of the reasons we haven't completely bought into it is because it looks nice in Emacs but not when you copy/paste it into a code snippet in a LaTeX paper. But I'll let others with more experience writing massive files chime in with their opinion :).
One of the reasons we haven't completely bought into it is because it looks nice in Emacs but not when you copy/paste it into a code snippet in a LaTeX paper.
Meh. You're using the wrong tools :P https://github.com/cpitclaudel/esh/raw/master/example/reference.pdf
Jokes aside, you're right; hence I'm proposing to drop that special syntax and instead highlight the one that's currently used.
Here's what the proposal looks like, concretely:
Now:
After:
I'm not exactly fond of the x_n
syntax in the source code (when debugging the code in the terminal there are already too many _
) so I would be rather happy if I could just write xn
and still have the subscript highlight.
Done! Please report any issues you run across :)
Hi all,
company-coq
got subscript highlighting a few months afterfstar-mode
got it, and in hindsight I feel that it works a bit better there. Unlikefstar-mode
(which requires an underscore), company-coq highlights all numbers at the end of variable names as subscripts. Concretely, that means that you can writex1
instead ofx_1
to getx₁
.Quick statistics suggest that fstar-mode's
_<number>
syntax isn't used very often in F* code in the wild, while identifiers with a number at the end are pretty common (see table below). And in fact, when the_<number>
syntax is used, it isn't always obvious that a subscript was actually desired (e.g.lemma_intro_modifies_0
,division_definition_lemma_1
,lognot_lemma_1
). In the entireulib/
directory, I could find only four examples of short variable names using the_<number>
syntax:s_1
,s_2
,qj_1
, andqj_2
. The only other cases that I could find where_
are used for subscripting are theint_8
,int_16
etc. types.How would we feel about changing F* mode to highlight
x1
asx₁
? To prevent confusion, this would mean ceasing to highlightx_1
asx₁
(otherwise it wouldn't be possible to distinguishx1
anx_1
). Of course, it'd remain easy to turn off subscripts highlighting entirely, and it would also be relatively easy to locally hide the_
, if desired.