From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: Using incremental parsing in Emacs Date: Sun, 05 Jan 2020 09:05:07 -0800 Message-ID: <86lfqlhm0s.fsf@stephe-leake.org> References: <83blrkj1o1.fsf@gnu.org> <86zhf4gwhl.fsf@stephe-leake.org> <83tv5cgvar.fsf@gnu.org> <86v9psgkqe.fsf@stephe-leake.org> <83mub3hao7.fsf@gnu.org> <86r20fgh01.fsf@stephe-leake.org> <83y2unf14x.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="205537"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 05 18:06:20 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1io9M2-000rHV-Gw for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2020 18:06:18 +0100 Original-Received: from localhost ([::1]:43788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1io9M1-0004YA-Bz for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2020 12:06:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33272) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1io9L0-0003aP-DF for emacs-devel@gnu.org; Sun, 05 Jan 2020 12:05:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1io9Ky-0005ch-It for emacs-devel@gnu.org; Sun, 05 Jan 2020 12:05:13 -0500 Original-Received: from gateway31.websitewelcome.com ([192.185.143.39]:37476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1io9Ky-0005YY-76 for emacs-devel@gnu.org; Sun, 05 Jan 2020 12:05:12 -0500 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway31.websitewelcome.com (Postfix) with ESMTP id B5C202F07 for ; Sun, 5 Jan 2020 11:05:09 -0600 (CST) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id o9KviWqJwqNtvo9KviAfHw; Sun, 05 Jan 2020 11:05:09 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BOTF6z40aqc7693YhkSjCWbYokU+tFHjcVTozGx25KM=; b=OwwsZRRTj/4Kwku/MW8+oh1wU rc4OdAQ27L+JPVpiEiyZVw/O1Kr0/SRHACn/kxeTuO2kaXQFVmLL/HBF0X2iMfKVrRm1/slQsckTu sJ7LgQnIgZnZrdTnWBU/dmxyGoTzinw+8qNw+PEAQZKLTYTGkrv8iAgV7iL7Wrw8HskFuDwqxUrbD m5bHZo0XDy3b5caLq1Q9Pa16IZMJZ/cMstEMFNc4KRAKEqpGD0Gqupdpo3e2J6CBpWRHoxQw3rqE7 3wK6wg4O27gRdgw5qTQWQ1ATq1/VW6dxG4t2FYxWRsbbKQuJlZ7SyNnri9bV/iJdPFHb5ZJ3fjp/B XOuYg2pMw==; Original-Received: from [76.77.182.20] (port=57414 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1io9Kv-002Dle-5A for emacs-devel@gnu.org; Sun, 05 Jan 2020 10:05:09 -0700 In-Reply-To: <83y2unf14x.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Jan 2020 21:54:38 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1io9Kv-002Dle-5A X-Source-Sender: (Takver4) [76.77.182.20]:57414 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 1 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.143.39 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243983 Archived-At: Eli Zaretskii writes: >> From: Stephen Leake >> Date: Sat, 04 Jan 2020 11:26:38 -0800 >> >> > I'm saying we should look into this and see whether there are better >> > ways that that. Suppose such a server had direct access to buffer >> > text: would that allow a more efficient interface than the above? >> >> No; lexing the actual text is not where the time is spent. > > the way we currently communicate with servers is to make a buffer > substring and encode it, which in itself is an overhead. And then > JSON adds to that. Right. The encode step is done when communicating with modules as well, because the internal encoding is not exactly uff-8. >> ada-mode builds on the current font-lock infrastructure; the font-lock >> timer triggers a parse on a range, and the parse actions set >> font-lock-face text properties. > > Font-lock by default doesn't use any timers, It does if you set jit-lock-defer-time, which I do (in my ~/.emacs, not in ada-mode). >> I don't think you are objecting to LSP in principle, but do have a >> problem with the speed penalty due to using JSON. > > Using JSON is one thing; talking to an external program is another. > >> Since other editors are succeeding with that, perhaps there is more >> Emacs could do here. > > Other editors don't need to go through Lisp, so they can do more stuff > faster, and also off-load some of the work to threads. We need to > find our own ways of being efficient, which might be different from > what other editors do. Ok. I've configured eglot and ada_language_server (from AdaCore); it works, but doesn't do everything ada-mode needs (yet; AdaCore labels this a work in progress). In particular, LSP does not currently support semantic highlighting (ie font-lock). There is a proposal to add that (https://github.com/microsoft/language-server-protocol/issues/18); it's not at all clear when/if that will make it into the standard. It appears LSP is not actually a "standard", just something Microsoft is making available; it is totally controlled by Microsoft. I'd be happier if they turned it over to some standards org (FSF, ISO, IEEE, ...). So far, I have not noticed a speed problem (even on very large files), but I haven't really pushed it yet. ada_language_server does one thing better than current ada-mode; provide cross reference information. Currently ada-mode uses some files output by the compiler to get cross-references; processing that information is noticeably slow, and the information gets out of date, so the user must request a cache refresh. ada_language_server provides cross references directly from the parsed sources, with no caching issues. So I'll work on adding that as an alternative xref backend for ada-mode. -- -- Stephe