From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Troy Brown Newsgroups: gmane.emacs.bugs Subject: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment Date: Tue, 14 May 2024 08:43:59 -0400 Message-ID: References: <86seykx66p.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="30043"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 70929@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 14 14:45:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1s6rWw-0007f9-6P for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 May 2024 14:45:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6rWi-0003lP-5i; Tue, 14 May 2024 08:45:04 -0400 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 1s6rWf-0003kN-MR for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 08:45:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6rWe-0002p4-TA for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 08:45:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6rWf-0004WY-Sz for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 08:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Troy Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2024 12:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70929 X-GNU-PR-Package: emacs Original-Received: via spool by 70929-submit@debbugs.gnu.org id=B70929.171569066817360 (code B ref 70929); Tue, 14 May 2024 12:45:01 +0000 Original-Received: (at 70929) by debbugs.gnu.org; 14 May 2024 12:44:28 +0000 Original-Received: from localhost ([127.0.0.1]:39138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6rW5-0004Vw-GS for submit@debbugs.gnu.org; Tue, 14 May 2024 08:44:28 -0400 Original-Received: from mail-ej1-f46.google.com ([209.85.218.46]:48361) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6rVz-0004Vl-AY for 70929@debbugs.gnu.org; Tue, 14 May 2024 08:44:24 -0400 Original-Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a59b097b202so3403266b.0 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 05:44:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715690652; x=1716295452; 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=aLQk8FBY9RL0HtcqFeiUwlHF8ZD1YZeMQudJtOJQctI=; b=ScMKp34Pi+J98eL7gb9Q5WCtm8F/7kt1Ie9JInDmWJuX2CHBD3qODyJCiUvv2TUxec xVZ1O67YO+yIUX5mm9p0G0jElc2tO2akvydwOa7X9oFiZzA0gZwG0XnNKPmmVJv4vw/N Ib/L7fRXoy/VUrCnZZ48jav24MnfqW2PbMw16seNw9iAx0mNVrWbuhO2GNiVkmKfY+3J JI1BJP2sPTSTiZePYYWUnLYj8GCHvAfcwCw2orkMfJL2WgaCkLiIxRYTlWbotfaxBiWI P7Vj7uwn82+kCruimiuJOrj/8SscaD6T653XBpvNXC3w0O/ckxgy+DQ9eZYEVSDmwWOU +stA== X-Forwarded-Encrypted: i=1; AJvYcCVFjuj+6I3kIh3mg0BCkU6dKfkJi/ijeNcpqhFoxZ2slI4GY4U9f6QEeT9kODyww5FSm9uSOpUu8XZArHIzef9SJa9gWww= X-Gm-Message-State: AOJu0YwVq8OucFV/DI+nVDWPwKtcm0v7RAGe8ncNa5o9+546dytdU+yP RqAaYWMVnOf1QEkLC/CH8P06odLZhTjyDhtcRhCc6yzYqk2TKsyy8kEDDfLgRYQ= X-Google-Smtp-Source: AGHT+IEi5mcVf5i8+4o2308RHa0W8BmtzOYIbXWu0ekgojUcnhzjRDvwQgrF9iDH85KRsX3FpEokFg== X-Received: by 2002:a17:906:b7c6:b0:a59:ef1f:83e4 with SMTP id a640c23a62f3a-a5a2d6417f0mr828471166b.59.1715690651782; Tue, 14 May 2024 05:44:11 -0700 (PDT) Original-Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com. [209.85.218.46]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17894d85sm716531866b.72.2024.05.14.05.44.11 for <70929@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 May 2024 05:44:11 -0700 (PDT) Original-Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a59c0a6415fso29609266b.1 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 05:44:11 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCW11U3nV4URwq1K8ReFpTuokUrriz/MSoU2x8MOAMaThi2ZDec7VeeC5AXmgaF1gNl7HbM0RSYmSiZKCeFBnZ+y2oPky+c= X-Received: by 2002:a17:906:2846:b0:a59:a85d:31c6 with SMTP id a640c23a62f3a-a5a2d6736b4mr889168266b.66.1715690651418; Tue, 14 May 2024 05:44:11 -0700 (PDT) In-Reply-To: X-Gmail-Original-Message-ID: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285014 Archived-At: On Tue, May 14, 2024 at 5:28=E2=80=AFAM Jo=C3=A3o T=C3=A1vora wrote: > > I've reproduced this on the clangd server and c++-ts-mode, but only after > turning _off_ electric indent-mode, which hides this effect. Yes, that's correct, electric-indent-mode can hide this. > > eglot--apply-text-edits, it uses save-excursion, and this prevents the > > point from being pushed to the end of the inserted spacing. It would > > seem that save-excursion should be avoided when applying text edits. > > Doing that naively would lead to chaos. Edits can be supplied to arbitra= ry > places in the buffer. Edits can happen in many situations, even when ins= erting > completions, for example. If you circumscribe yourself to OnTypeFormatti= ng, > even Clangd for example performs edits before the full expression that pr= ecedes > the newline. There not even anything forcing the server to provide > whitespace-only changes. > Possibly, although VSCode, which is probably considered the model LSP client implementation, allows this to happen. Not saying it's necessarily correct in doing so, just another data point. > The workaround of enabling electric-indent-mode or just turning off > OnTypeFormatting > via eglot-ignored-server-capabilities is much better. I'm not sure a workaround of turning this off is desirable if you're trying to use it for indentation. If the mode doesn't have internal indentation support, this will fallback to something like indent-relative which might get you in the ballpark but won't be as accurate as having the language server provide you with the correct indentation. I'll bring this to the attention of the Ada Language Server developers.