unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Comments to the new tree sitter implementation
Date: Mon, 25 Apr 2022 21:08:44 +0200	[thread overview]
Message-ID: <87v8uxx9oj.fsf@thornhill.no> (raw)
In-Reply-To: <06C91D4F-3505-45B9-8340-BADE3EE665D1@gmail.com>


Hi, there!

>
> Sorry that I can’t get back to you very soon. I’ve been incredibly
> busy recently. I’ll find time to look at your points and try to debug
> the problems you mention with typescript-ts.el.
>

No worries.  I'll just note one more thing because I remember it now:
Why are you calling the font lock default function after tree sitter has
done its job?  That seems like the wrong thing for several reasons:

1. Shouldn't tree sitter be sufficient?
2. It makes the default function get higher precedence than tree-sitter,
causing some troublesome behavior.

Specifically, if you set single-quote as a string in the syntax table,
to make the major mode understand it as a string delimiter, it will mess
up comments.  This example snippet will make the rest of the file
fontlock as a string:

```typescript
function foo() {
  // don't mark the rest of the file as a string because of this:
  //    ^
  const dont = 3;
  const do = "":
  const it = {};
}
```

If the last two lines of `tree-sitter-font-lock-fontify-region` are
removed, things appear to work as normal.  It also works fine with
things such as eglot marking a variable as unused in the comment face
etc.

All the best,
Theodor



  parent reply	other threads:[~2022-04-25 19:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 12:33 Comments to the new tree sitter implementation Theodor Thornhill
2022-04-23 22:27 ` Stefan Monnier
2022-04-24  5:06   ` Theodor Thornhill
2022-04-24  5:36     ` Theodor Thornhill
2022-04-24 20:27       ` Stefan Monnier
2022-04-25 18:52 ` Yuan Fu
2022-04-25 19:07   ` Eli Zaretskii
2022-05-07  6:49     ` Yuan Fu
2022-05-07  7:11       ` Eli Zaretskii
2022-05-07  7:17         ` Yuan Fu
2022-04-25 19:08   ` Theodor Thornhill [this message]
2022-04-25 22:46     ` Yuan Fu
2022-04-26  6:38       ` Theodor Thornhill

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=87v8uxx9oj.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).