From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Eglot "inlay hints" landed Date: Fri, 24 Feb 2023 02:28:09 +0000 Message-ID: References: <87356xv65z.fsf_-_@gmail.com> <83fsawriye.fsf@gnu.org> <835ybsr6aa.fsf@gnu.org> <83356wr224.fsf@gnu.org> <87bklktu89.fsf@gmail.com> <83y1oophd0.fsf@gnu.org> <83k008pah3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40921"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , dalal.chinmay.0101@gmail.com, emacs-devel@gnu.org, dimitri@belopopsky.com, luangruo@yahoo.com To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 24 03:29:07 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVNpa-000AQd-Q4 for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Feb 2023 03:29:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVNoy-0004U3-FF; Thu, 23 Feb 2023 21:28:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVNou-0004Tn-6w for emacs-devel@gnu.org; Thu, 23 Feb 2023 21:28:24 -0500 Original-Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVNos-0000Fa-JQ; Thu, 23 Feb 2023 21:28:23 -0500 Original-Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1723ab0375eso13703938fac.1; Thu, 23 Feb 2023 18:28:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677205701; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=y8KgJ46/PlvOJJHIrlv4TNc7YvyU83ZyQBOtAlRxpX0=; b=E/tiUa6qpSlhFVd6KrLa6iuXxGV6o9Ww7h3qTmIqPqJ0Ied5Wu4mhLhg4UFn/04svd /h40tSXcixrAl1hCrOyweImod/41Lil3egQv3swU9CCrgComjoakHTOox57+UOdt8RbT OKyCRoaWpsRHlIiqiz4GhBXlYA+jfauS7DnV58FGUVly/1yS6uYWXZ/680IItUSaEpHb IPu3x3+anjZ7U0qPu64UmwR1YL+uR7y19lJhA/1rjQSHdiFDTT4TU4CPJKacQQq9ilIj 1gcnwYaHnxbLk/YMfK9KuSxFV9H7NwE9fIv8VcpzXEqRrtPVyK3JUbabHpQg8sapLIrj vmSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677205701; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y8KgJ46/PlvOJJHIrlv4TNc7YvyU83ZyQBOtAlRxpX0=; b=ZfuB4GixoUyQAipY6LiAIzNL8nd0uU9LZLFJloniLDa5CAqRJvIYbIQ5V/NJCMYpYd CXJ42PxY4ZfTTY8S/2GaDJITB+UC+as/DRTOqRLNsLiQWbgoVzCoBKCL/dBvA2Nu1bnI JVcH1pGdqiMKwoaoJoiApfJTEpFNPJubuj77CWIeJA3XesV8o9wnC7YPKDzFurRiPiiW +WY0fhPjwrd0c7KdqGTdt0R54m36h4fiJcJjsmFSi88WameHKiiPo9zbaogmYjCHBDGo EgVASK8mUdfDDhh2IUAuif35P+FFfotM2WXbbSx/+wM1pNhfJKgtHAU+Ae3gZ4mOiDGn j6ng== X-Gm-Message-State: AO0yUKW0TQwkP3ecRF2DV73gwLIZFDSUud+3uyWHXQXTG1atTZcuxK/D ruIeSVGS2TkwEQtaUjmPHid43rLy9cYk04/mef8= X-Google-Smtp-Source: AK7set9zeRhWAdKzYIr2OWQRgLpNOzed/9TiSv/4SPIaUpZxKORYK0+UM19dlx/EMR3BUP7mjc233AGQnX3JsvX3e8o= X-Received: by 2002:a05:6870:3911:b0:169:ce1c:d7c2 with SMTP id b17-20020a056870391100b00169ce1cd7c2mr913050oap.5.1677205701005; Thu, 23 Feb 2023 18:28:21 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303732 Archived-At: On Fri, Feb 24, 2023 at 1:08 AM Stefan Monnier w= rote: > In your case, I suspect for the affected language servers there's not muc= h > more we can do but to say that the whole buffer's inlays need to be > recomputed after a change. I'd really like to avoid that. If it comes to that, and the problem really is annoying enough (it might not be, and inlay hints are usually a best-effort thing by the servers themselves) then I think going back to the window-scroll-functions might be a better option. It doesn't have t= his problem. > > To do this, we use a jit-lock implementation detail, > > jit-lock-context-unfontify-pos, which tells us that the contextual > > fontification has just finished. Not sure how brittle it is, but it > > seems to work reasonably. > > I think it won't work reliably in the case where the "immediate" > jit-lock refresh happens to cover everything until window-end (e.g. we > just inserted chunk of text that ends after window-end). In that case > the jit-lock-context thingy will just mark the rest of the buffer as > "not fresh" but won't call your fontification function at all. Yes, I noticed something like that: many immediate small jit lock calls where the condition was true. > [ And of course, there are also those few rare modes that don't use > jit-lock-context at all. ] > > I think using your own timer is probably the better option. I'd > make it wait for `eglot-lazy-inlay-hints` rather than (+ > eglot-lazy-inlay-hints jit-lock-context-time), but I'd give it as > default value a value computed from `jit-lock-context-time`. Using a timer is necessary, but I've found that a 0-second timer is sufficient to coalesce "well". But we only fire the timer if the "unfontify-pos =3D=3D point-max" condition is met. Then we don't need to compete with jit-lock-context-timer, which is really the part I fou= nd very bad. I've pushed this last version to emacs-29. Have a look there, please. And thanks for the insight! Jo=C3=A3o