[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regarding Emacs, js.el, template-strings and syntax-tables
From: |
Dmitry Gutov |
Subject: |
Re: Regarding Emacs, js.el, template-strings and syntax-tables |
Date: |
Tue, 5 Sep 2017 11:25:26 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Thunderbird/56.0 |
On 9/5/17 10:00 AM, Anders Lindgren wrote:
In other languages where the constructs only can be
simple variables, I would prefer to retain the string face (for the sake
of things like the background color) and color the variable name by
prepending the variable name face.
Sure, why not.
In my experience, I can read code easier if the delimiters aren't
highlighted the same way the content is. (In other words, the current
Ruby implementation isn't ideal for me.)
Yes, so in the case of ruby-mode, the delimiters will have some special
face (keyword? IDK), and the content will have the default face.
While we're on the subject. I've been thinking about highlighting
parameters in functions and blocks in Ruby.
Let's maybe make it an optional mode, so ruby-mode doesn't stand out too
much (or discuss whether all modes should do that if possible, on
emacs-devel). But I've been looking at this too, albeit from a different
standpoint (completion of local variable names).
It wouldn't be too
difficult, and it would make code easier to read. Unfortunately, it
doesn't include all variables as local variables can be created on the
fly using a plain assignment in Ruby.
Finding assignments is easy (just a regexp). Tracking variable scopes
(defined by their belonging to methods, or blocks, or even class/module
bodies) looks harder to me. We can do that by parsing expressions with
SMIE, but that's not fast if we have to parse the whole class body
(there are some big classes out there).
Limiting ourselves to only methods might be fine, though.
As a parallel, my lisp-extra-font-lock package
(https://github.com/Lindydancer/lisp-extra-font-lock) do this in Lisp
modes for function and lambda parameters and local variables introduces
using `let`, `dolist` et.c. Now that I've been using it for a couple of
years, I would not dream of going back to the near black-and-white world
of the default lisp modes.
I like the idea, but seeing the red on the screenshot is a bit
off-putting. red is for errors.
- Re: Regarding Emacs, js.el, template-strings and syntax-tables, Anders Lindgren, 2017/09/01
- Re: Regarding Emacs, js.el, template-strings and syntax-tables, Dmitry Gutov, 2017/09/04
- Re: Regarding Emacs, js.el, template-strings and syntax-tables, Anders Lindgren, 2017/09/05
- Re: Regarding Emacs, js.el, template-strings and syntax-tables,
Dmitry Gutov <=
- Re: Regarding Emacs, js.el, template-strings and syntax-tables, Anders Lindgren, 2017/09/05
- Re: Regarding Emacs, js.el, template-strings and syntax-tables, Dmitry Gutov, 2017/09/05