unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Jostein Kjønigsen" <jostein@secure.kjonigsen.net>
Cc: Yuan Fu <casouri@gmail.com>,
	jostein@kjonigsen.net, 61081@debbugs.gnu.org
Subject: bug#61081: 29.0.60; typescript-ts-mode does not correctly fontify imports with aliases [PATCH]
Date: Fri, 27 Jan 2023 13:48:15 +0100	[thread overview]
Message-ID: <87ilgsf8j4.fsf@thornhill.no> (raw)
In-Reply-To: <c709ff5c-aef2-e2d3-1a6f-eceec0c2fdbf@secure.kjonigsen.net> ("Jostein Kjønigsen"'s message of "Thu, 26 Jan 2023 19:55:38 +0100")

Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:

> Currently typescript-ts-mode and tsx-ts-mode handles imports with aliases incorrectly.
>
> Consider the following case:
>
> import { someFunc as someAlias } from "module";
>
> In this case the entire import ("someFunc as someAlias") will be highlighted as a variable name. "as" is also
> highlighted as a variable, rather than a reserved keyword.
>
> To be consistent with how we otherwise do things, we should only highlight the variable which is new and/or
> introduced, in this case "someAlias".
>
> Attached is a patch which fontifies import-declarations somewhat more correctly.
>
> The following cases have been tested and all fontify properly:
>
> import gnu from "fsf";              // highlights gnu
> import { gnu2 } from "fsf2";        // highlights gnu2
> import { gnu as gnu3 } from "fsf3"; // highlights gnu3
> import * as gnu4 from "fsf4";       // highlights gnu4
>
> Theo: Looks good to you?
>
> Yuan: I believe these same sort of fixes could be applied to js-ts-mode and friends.
>

Thanks! Installing today :)

Theo





      parent reply	other threads:[~2023-01-27 12:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 18:55 bug#61081: 29.0.60; typescript-ts-mode does not correctly fontify imports with aliases [PATCH] Jostein Kjønigsen
2023-01-26 19:05 ` Dmitry Gutov
2023-01-27 12:48 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilgsf8j4.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61081@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=jostein@kjonigsen.net \
    --cc=jostein@secure.kjonigsen.net \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).