[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cc-mode fontification feels random

From: Jim Porter
Subject: Re: cc-mode fontification feels random
Date: Thu, 10 Jun 2021 08:59:52 -0700

On 6/10/2021 8:16 AM, Ergus wrote:
1) What is finally the most desirable/long path/future feature? I mean,,
finally what is preferred by the developers to support in the future?

lsp or tree-sitter?

Elsewhere in the thread, I and a few others discussed this briefly. The solution other editors use (and which I think is ideal) is to start with a base that does its best purely by looking at the syntax of the file, and then augment that with LSP. For Emacs and CC-mode, this could mean continuing to use the current implementation, or switching to something built on tree-sitter. Then on top of that, Emacs can consult LSP for more-accurate information. I'm not sure whether this means LSP would take over entirely or if it would merely augment the base-level syntactic highlighting. Figuring that out would probably require doing some experiments to see what the best solution for Emacs would look like.

One of the main benefits of continuing to have some form of (non-LSP) syntactic highlighting is that it works for everyone. Even if you don't have an LSP server installed, you may want to edit a source file in a particular language. Your LSP server of choice may also lack full semantic highlighting support (it's a pretty new feature, as I understand it). Having a reasonably-correct baseline that works everywhere is nice, and hopefully there are no plans to get rid of that.

LSP *may* also be too slow in some situations (though this is just a guess). For example, when editing a file over TRAMP, the LSP server runs on the remote side; if the network is slow, this could result in delayed fontification while editing, which reduces the usefulness of fontification. In addition, a new checkout of a large project won't have any cached LSP information, so analyzing the code enough to generate semantic highlighting may take some time. These might not actually be problems, but they do make me a bit skeptical about the performance of a purely LSP-based fontification system.

- Jim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]