|
From: | Stefan Monnier |
Subject: | Re: Regarding Emacs, js.el, template-strings and syntax-tables |
Date: | Thu, 24 Aug 2017 06:53:35 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
>> function getGreeting(name) { >> let greeting = `Hello, ${name}!`; >> return greeting; >> } Indeed this problem has been with us in sh-script.el for many years. There are several different aspects at play: - how should font-lock display `name`. Should it have a normal face as if it weren't inside a string? Or should have a kind of combination of string-face and something else? - how should we handle nestings of such constructs. - several parts of Emacs like to know if we're inside code/string/comment (usually using (nth [3|4|8] (syntax-ppss))). Should these all consider "name" as being inside code? Or inside string? Or should we revisit all those cases one-by-one? In sh-script, we use syntax-propertize to make sure the whole string and its contents is all considered as a string and nothing else. This was the simplest solution and probably corresponds to the current behavior of js.el (and typescript.el) as well. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |