From unknown Wed Jun 18 23:03:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#70929 <70929@debbugs.gnu.org> To: bug#70929 <70929@debbugs.gnu.org> Subject: Status: 30.0.50; eglot--apply-text-edits prevents point adjustment Reply-To: bug#70929 <70929@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:33 +0000 retitle 70929 30.0.50; eglot--apply-text-edits prevents point adjustment reassign 70929 emacs submitter 70929 Troy Brown severity 70929 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon May 13 22:15:31 2024 Received: (at submit) by debbugs.gnu.org; 14 May 2024 02:15:31 +0000 Received: from localhost ([127.0.0.1]:36216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6hhS-00054U-Mt for submit@debbugs.gnu.org; Mon, 13 May 2024 22:15:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:59770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6hhN-00054M-If for submit@debbugs.gnu.org; Mon, 13 May 2024 22:15:29 -0400 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 1s6hhM-0005Ju-AV for bug-gnu-emacs@gnu.org; Mon, 13 May 2024 22:15:24 -0400 Received: from mail-ed1-f54.google.com ([209.85.208.54]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6hhK-00073X-I2 for bug-gnu-emacs@gnu.org; Mon, 13 May 2024 22:15:24 -0400 Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-572c65cea55so558258a12.0 for ; Mon, 13 May 2024 19:15:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715652920; x=1716257720; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/BwXpUWWoqNWnwz8iwgA1Dx0iCWfEZMCJAUWkvfyCMc=; b=CizzJAFYq6aomBAd81RVD5EpYtdp0LwFlJhgTVCQkadwknXfveAuB/y7Cy/FwylqTd YNfZkkM0YDN5cOHXRICRw7HRwztXzkgW1erfj2MM+wQ8nhosiYW64H9n4va4i3F7OLQ8 AtXb05efDVYa2+IfAnvrxSkAMFV/KfUGa56xm4B8QCDj3vuW+C2jWxQKEv0OsCGDOMUF apnNjhImssyfggWYkRMG1XuqKJK5lD3WJKP5sWYL0XofCgY91DQsrDgC0tDUYOU4GRz6 EmhFPwcMxuBD8uJ6rItte3AxkIHRG89xrNOjYjvBrvkriYNUBlY9qw1l983v7ury2fMp 9P2w== X-Gm-Message-State: AOJu0YxyfgkdsER8x0MCcsXtsuYs+srE/pdi8C9Zd9VkJGsnS3bOLlTN NU2X5S8eOdVmqz1guAfU/E4u9J4lqEf/3J1J0TFPh+7LFJL6tH2ZnZlvIAKG X-Google-Smtp-Source: AGHT+IGEz2+s8cI+JI66sHSUl74lAsLH7kmxbJfwmH+E5uAR3fJokyYlzfYWZWEwv+MlQnL9TBQaqQ== X-Received: by 2002:aa7:c992:0:b0:572:b0a8:65fd with SMTP id 4fb4d7f45d1cf-573326eddfemr10907873a12.6.1715652919969; Mon, 13 May 2024 19:15:19 -0700 (PDT) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com. [209.85.218.44]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733c323887sm6982155a12.89.2024.05.13.19.15.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 May 2024 19:15:19 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a59a609dd3fso863321166b.0 for ; Mon, 13 May 2024 19:15:19 -0700 (PDT) X-Received: by 2002:a17:906:6a10:b0:a59:9636:f3e with SMTP id a640c23a62f3a-a5a118c520bmr1428335666b.33.1715652919177; Mon, 13 May 2024 19:15:19 -0700 (PDT) MIME-Version: 1.0 From: Troy Brown Date: Mon, 13 May 2024 22:15:07 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: 30.0.50; eglot--apply-text-edits prevents point adjustment To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.208.54; envelope-from=troy.s.brown@gmail.com; helo=mail-ed1-f54.google.com X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Language Servers may use onTypeFormatting to provide indentation for a buffer. When this happens, the language server will indicate a newline trigger character (in the DocumentOnTypeFormattingOptions). In the Emacs buffer, after hitting RET, point is moved to the next line and a textDocument/onTypeFormatting request is sent from Eglot to the server. The server responds back with the corresponding spacing prefix for the line in newText of the TextEdit response. However, when Eglot applies the text edit to insert this spacing, via 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. This issue has been observed with the Ada Language Server. From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 01:31:16 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 05:31:16 +0000 Received: from localhost ([127.0.0.1]:37045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6kkt-0007sf-TZ for submit@debbugs.gnu.org; Tue, 14 May 2024 01:31:16 -0400 Received: from mail-ej1-f52.google.com ([209.85.218.52]:53478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6kkr-0007sX-GE for 70929@debbugs.gnu.org; Tue, 14 May 2024 01:31:14 -0400 Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a5a0013d551so593872266b.2 for <70929@debbugs.gnu.org>; Mon, 13 May 2024 22:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715664606; x=1716269406; darn=debbugs.gnu.org; h=mime-version:face:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=BLbdpqeogqJ9eHS9htuXymzV8LUX/EZl5WvxGTjWc9M=; b=GXVr6O5aM0l6P0L2s3peA7BxPHonBZGtvOZE3GpRnUwuOg4ULAyeXriYerKoCD464G /Zf1P/N/ALPZmWi11lw2v7RAvtlxv/FXoApjpWJCuig5bDi3RCyZK1DT5+JJM53y51EL 3dLiXbh4qMdmQaId5H7uquG8JYKkfyr6i4QnznbXV6+UziZVb9WVm36ovzSFJvVd60q9 dV0MC3KDSn4gbVz2pq0KIta8QtsxByP9vbYGXQFFEZjgiAGe/KmbMEHg8i3LwXBnf5fi g8x8S4hyz3w0cd48xb8VXBlv0ay5zjk8gjmKcJo6kDE7vEnAZr3/yy9FpVbY3lVjvPFW cB1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715664606; x=1716269406; h=mime-version:face:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BLbdpqeogqJ9eHS9htuXymzV8LUX/EZl5WvxGTjWc9M=; b=i8CzqO2gB4BHMa0Ykc++ILzVNEr5vj7NI2eatYcOWLFJnrBI8IaOr7Z6HpKvZIhmeK oBVeYeqZiRnH51gtTc797oVE/W227e+g5DucpJuUcv7YnnETUKSma0rcZdoZ4cVIo7Px djF3iV8/7UOSmtHoDHULYhPY5yr/cD2I3tUG7u0RRpKUnhajOjNom2ULXz0juU9XrZyG h8+uFVYgPfsMG8esCzuXPxRPH+Vv579yAevH2onRf16bAX30xQp8BrBS1em9YZ9Qk4Fa tUHv4cJ5tvbU2SVPTnkk27jV07HZHLJJGu6uVEkspKBLLi1+YczGB1uOAXAvzGAQYv0q QTMQ== X-Gm-Message-State: AOJu0YweKNnKX+/zgUPpelSs6Ybq+z8erDxBzfq7eR4S5kvhB2muWJrX Mf727Gejx/UoiG7DvQRVAK+EhJCzwapd59JKncfCh8PdVu4yP2EJFem8PA== X-Google-Smtp-Source: AGHT+IGTwfVAERES38ZEwnvK89buCe0rwv0p66Kd6pGpZFRTYFkOXYPB08B0GZq1m6+nCBXxmgWXJA== X-Received: by 2002:a50:c012:0:b0:56d:f3f3:f61f with SMTP id 4fb4d7f45d1cf-5734d597da8mr10592473a12.9.1715664605563; Mon, 13 May 2024 22:30:05 -0700 (PDT) Received: from betli.gmail.com (catv-213-222-160-137.catv.fixed.vodafone.hu. [213.222.160.137]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733beb89e7sm7253341a12.21.2024.05.13.22.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 22:30:05 -0700 (PDT) From: Felician Nemeth To: Troy Brown Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment References: Date: Tue, 14 May 2024 07:30:04 +0200 In-Reply-To: (Troy Brown's message of "Mon, 13 May 2024 22:15:07 -0400") Message-ID: <87le4d55b7.fsf@betli.tmit.bme.hu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEU2EgDVmFNHKAa4dz4q AwCDUSH2zWrE61tmAAACeklEQVQ4jU2UwY7jIAyGEZN5ABSFc9Ytcx6K6DmqmHsD8tyZKrz/I+xv yI6WKlHlj982tomiVckiWrUrgRU5jlqMpJKCkch5W419DQAiQGHDxdrWmm0/2kXCApiUmrZLq20s cjexq3VL25QuxjY7wOcJVEpb+jLeGLAK+OMyaa1hx9rFbkwHFWBVA2y8w1wHaLE7GuDdw5cEuOM5 SLIdrpwBkN0ezwI7nYoiilqthbcYc89KgC5+NnaOHGbZz0T6BCEgOLJ0vmYXuNdPAIXgDZJhF2Yu fjnPNwAsoUTUN/P8q3AAyz4zB/xmifEfiIbvS4jh7b7QqZiSm4MJC5kXNpCRaOsoyQXAMN2XCJfs j94NKfo7ACKUEgKE3y+Sg4jibUZ1A0jgYpxtvYMC3gHaHPq6x32ACeALIZoZxB+l9VrRNIA1ncRg wwC8pvQIvYO+a2yt3VXMVyli6L0VV6aOrJa4CpilVQA+eHt0xavk61akih5BUMay/0BAqu783C5h FifY/3QsAIoWYk6PgpwAzLI652+96e2IfN2cF+BD1uT23F21Ghh5OUl4RlO15oh5A2iv+Zk2wsjZ 2DtB5Sm3A4P0+kyb2vs4iEW7G9ohoN3Stl2kVat6MCkXldo6OKaE8P6GhmrKKxWZXQH1iklhhn+d iVeNf6mDdkV0ltFwApRbp+kXSGBFHGV2aPqnIIyQyzhD5n47khqKI08bIapcas4O+hPkct20NAEv ALRuZFUp3PrnQSAm+4lTdHCsYYZ/nGqQrM5z3NS3zefFxkfFPRFbsjpIfbTlvF3ibpVZQ9nzqv60 F/KXSRLJ1AGappJulZll70N/qz6EfwEOCdYOuTHAzAAAAABJRU5ErkJggg== MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70929 Cc: 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Troy Brown writes: > Language Servers may use onTypeFormatting to provide indentation for a > buffer. When this happens, the language server will indicate a > newline trigger character (in the DocumentOnTypeFormattingOptions). > In the Emacs buffer, after hitting RET, point is moved to the next > line and a textDocument/onTypeFormatting request is sent from Eglot to > the server. The server responds back with the corresponding spacing > prefix for the line in newText of the TextEdit response. However, > when Eglot applies the text edit to insert this spacing, via > 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. > This issue has been observed with the Ada Language Server. If I remember correctly, the LSP specification does not say where the point should be after onTypeFormatting. Something like this motivated the rust-analyzer developers to introduce their own SnippetTextEdit extension. The upcoming LSP version is going to contain a slightly different version of the SnippetTextEdit. If my memories are correct, Ada Language Server should use this SnippetTextEdit to unambiguously communicate its intent here. (However, Eglot does not currently supports SnippetTextEdit.) From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 02:24:03 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 06:24:03 +0000 Received: from localhost ([127.0.0.1]:37346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6lZz-0000QP-1k for submit@debbugs.gnu.org; Tue, 14 May 2024 02:24:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6lZu-0000Q0-3T for 70929@debbugs.gnu.org; Tue, 14 May 2024 02:24:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6lZl-000423-8U; Tue, 14 May 2024 02:23:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=BOACMtfcXM9xqrqvJBaAW9bXlc8sJR3NaAQTUBJ9Q5A=; b=ME13D6KysyJDaUj+7Fza s9E6tR02y9nW79UfJOkNsiYsslQg5gN0/zZmzKHuXqWbiy0TnlqwNQe0brkDEfwokJeIFssnU0xeq qHurWw0zn965PX3NbOzmBnRBfD9Vwy5rSsAuvqEps9FSeJGH1fsb+QUiuH+11KF4lZkJ7CcfkwMN1 rZyTPX4EnhowuvhMi5asLYQMQ0p/9VZznao6Nvqoo9g9+c+8PanSTvZhzFoABG54B+t80Cugv6YhZ ya5kVZT2HnS5Vk/Y5xeWW08LT2KcLHfb8BCkpmBDyBMvGwSKBfxNMXEPh4DbMh+Cmz8sEHnuLetox Pha0JOLaesmceA==; Date: Tue, 14 May 2024 09:23:42 +0300 Message-Id: <86seykx66p.fsf@gnu.org> From: Eli Zaretskii To: Troy Brown , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= In-Reply-To: (message from Troy Brown on Mon, 13 May 2024 22:15:07 -0400) Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70929 Cc: 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Troy Brown > Date: Mon, 13 May 2024 22:15:07 -0400 > > Language Servers may use onTypeFormatting to provide indentation for a > buffer. When this happens, the language server will indicate a > newline trigger character (in the DocumentOnTypeFormattingOptions). > In the Emacs buffer, after hitting RET, point is moved to the next > line and a textDocument/onTypeFormatting request is sent from Eglot to > the server. The server responds back with the corresponding spacing > prefix for the line in newText of the TextEdit response. However, > when Eglot applies the text edit to insert this spacing, via > 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. > This issue has been observed with the Ada Language Server. Thanks. João, any comments or suggestions? From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 05:29:27 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 09:29:27 +0000 Received: from localhost ([127.0.0.1]:38185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6oTP-00059q-4F for submit@debbugs.gnu.org; Tue, 14 May 2024 05:29:27 -0400 Received: from mail-lj1-f170.google.com ([209.85.208.170]:58380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6oTM-00059i-3v for 70929@debbugs.gnu.org; Tue, 14 May 2024 05:29:26 -0400 Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2e3e18c240fso58508591fa.0 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 02:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715678897; x=1716283697; darn=debbugs.gnu.org; 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=FcnvQTbSmq+zeO1Zjt4HJ8VfikB1f9ZvZ1IIrnbz8uQ=; b=DypQ1x9afAHzfa+SUmvhSsHvwGtWBU+jc+0z30YrUJwfPGWhIfo2LHwTLTGbxbfMXD JT4HfT068P3QktekafO6cL0c4+dDaQ9cwQ/pJ86azzjlXXZMIINKO6VElZXWhgcYKcvh rHlwCSgbHmfaMVheLj53rmqJRBO1NAn2uP+A/yycBLMV2+JM/zxITCwFXOzvGq9v4bvk U3g4kHfosbygOtSYwwonfuukvhRAGnfIscUc31s7sxj5haDwCygGy+91qCTdsFbIUupT ykUhBNjw/S46GuNuGwQXAeeBN6HySHg3Fsb90jz2BPQ67wCBUFAN0P3jFzG7fUdGfyVJ X2YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715678897; x=1716283697; 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=FcnvQTbSmq+zeO1Zjt4HJ8VfikB1f9ZvZ1IIrnbz8uQ=; b=V3XAWcHzflHd4coIBYjRNcc9CB7FuKpR41XgaSM9zf/RaV4t33+m928eCXe7mk8l8R YmVzVsycDA50eGCzHJC3HiCJHiQMZU3C2W5Phm4jfWMZlo/4a0Zl7CuGKePoBvG1yb1b aHJzcUycAOH44kaVqnYTcjI8vWtrJQHYLQOv21XdVmqESl9BUJjKr6r9qV6lRGedYd8J RHJGuKcgZ0wExS1N7KkRA/R/BZ9e48cZGUawIADT/3vkPdIL5EdEH6DOkVHTdyTcyU+q 2eW2jWEH4p/P2CFyzPaMYWianJZZru9BSd+ZlNFdujjwCQFOdaeIaWK/ksr3UgrzpZfl jUfg== X-Forwarded-Encrypted: i=1; AJvYcCVwEjOy+B9XL//ZDb6+2JBsE80Jugn5ZdU1N+Ufa44ulJfLLeO9H802oOrZycQfGoM+UJywTrEFmlB7i3FvTwZ6O8F1NUw= X-Gm-Message-State: AOJu0YxIUiy7HDVcqJcycy48sJD9rPICACvOEIQjBXUynMLPoe6Tj+Zw aMj954LuMpEOGeLeGWcaCmsc9zJlqIrUe9LvKzPpiN+s3il3qpwObikTxWfHLCWWjOhjGiOv+9+ DksOdZ9b4gRHtp4MZcBqHP8PSZ+A= X-Google-Smtp-Source: AGHT+IEOTguMvuRJt2hlBeKE5MUYrHcgY5/qHJPGCAm06mROnCSrKO3B7/OXHSu4rqG94SkrVZ1G3qKKf6OWAytrYOM= X-Received: by 2002:a2e:751:0:b0:2e6:8b17:ca10 with SMTP id 38308e7fff4ca-2e68b17cd3bmr50853511fa.13.1715678896742; Tue, 14 May 2024 02:28:16 -0700 (PDT) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: <86seykx66p.fsf@gnu.org> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Tue, 14 May 2024 10:28:05 +0100 Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70929 Cc: Troy Brown , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, May 14, 2024 at 7:23=E2=80=AFAM Eli Zaretskii wrote: > > > From: Troy Brown > > Date: Mon, 13 May 2024 22:15:07 -0400 > > > > Language Servers may use onTypeFormatting to provide indentation for a > > buffer. When this happens, the language server will indicate a > > newline trigger character (in the DocumentOnTypeFormattingOptions). > > In the Emacs buffer, after hitting RET, point is moved to the next > > line and a textDocument/onTypeFormatting request is sent from Eglot to > > the server. The server responds back with the corresponding spacing > > prefix for the line in newText of the TextEdit response. However, > > when Eglot applies the text edit to insert this spacing, via > > 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. > > This issue has been observed with the Ada Language Server. I've reproduced this on the clangd server and c++-ts-mode, but only after turning _off_ electric indent-mode, which hides this effect. > 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 arbitrary places in the buffer. Edits can happen in many situations, even when inser= ting completions, for example. If you circumscribe yourself to OnTypeFormatting= , even Clangd for example performs edits before the full expression that prec= edes the newline. There not even anything forcing the server to provide whitespace-only changes. The solution would have to be something like checking these specific edits in this specific situation supplied by the server one by one and upon finding one that is whitespace only and overlaps the points make that change a "push" change. This is simply too complex of a change (you can take a stab at it and provide ample testing, if you want). The workaround of enabling electric-indent-mode or just turning off OnTypeFormatting via eglot-ignored-server-capabilities is much better. From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 08:39:21 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 12:39:21 +0000 Received: from localhost ([127.0.0.1]:39113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6rRB-0004S8-8N for submit@debbugs.gnu.org; Tue, 14 May 2024 08:39:21 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:60879) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6rR9-0004S0-0G for 70929@debbugs.gnu.org; Tue, 14 May 2024 08:39:20 -0400 Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-573061776e8so35024a12.1 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 05:39:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715690352; x=1716295152; 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=dbXlzBH/tgYrFBCyUisyQ8qQWk7qwTAmwBpt4N4fjGo=; b=NH/ZYeJpdjMaLMgk1zoOJf5P82eJ/1NiHXjK8gtpuDNC2IUH4gY/pghsCcnFj176sR mj3GJ2tGUAmBPE2l1ufB/bMP59T2XAGx1ZxWMh7QKFOucofowVLQqVTdVcnreq+QuiuH 7zHQjAsG2R3tFi73AHmKEqCAE9cvSDUFG11tXOZCJGe71Z/QeOhasAhCoY6+VKK1vE1D Ern/WeQHhO89/mixaCOONw0eHvYs0C2rj//W8whxy2A3aiWKxK+hSZ6wTWPGOHRzTDDB ZezADbFVbOEFmdQ06dqX658v9VwNrM4DrTpwUvvW/KIXPG3U5n7oYf43q6t0N1UZDWCg ws6Q== X-Gm-Message-State: AOJu0YxJhw3KnFqg4fWeUO2Tc0sLR9idjRSQKlF/hrhs1Q2mVGsnAW0F lufF68e8lrXPM7oELucPWU1BzgIB8sb/ay4/xQNhpIf4K9Ajv2OVX6XgzLONEgg= X-Google-Smtp-Source: AGHT+IF6CnNTwThatTnPVoe6XiM2N7ZdNJjpONjLz6JaIpd3GTrV0bTX0CNrStigoE/EkzMu0Aw09Q== X-Received: by 2002:a17:906:c304:b0:a59:ccb9:846d with SMTP id a640c23a62f3a-a5a2d5d364bmr712327366b.37.1715690351368; Tue, 14 May 2024 05:39:11 -0700 (PDT) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com. [209.85.218.43]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17922159sm721421466b.97.2024.05.14.05.39.11 for <70929@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 May 2024 05:39:11 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a59a387fbc9so31307966b.1 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 05:39:11 -0700 (PDT) X-Received: by 2002:a17:906:c405:b0:a59:c319:f1e0 with SMTP id a640c23a62f3a-a5a2d681e12mr794099466b.75.1715690350854; Tue, 14 May 2024 05:39:10 -0700 (PDT) MIME-Version: 1.0 References: <87le4d55b7.fsf@betli.tmit.bme.hu> In-Reply-To: <87le4d55b7.fsf@betli.tmit.bme.hu> From: Troy Brown Date: Tue, 14 May 2024 08:38:59 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: Felician Nemeth Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 70929 Cc: 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, May 14, 2024 at 1:30=E2=80=AFAM Felician Nemeth wrote: > > If I remember correctly, the LSP specification does not say where the > point should be after onTypeFormatting. Something like this motivated > the rust-analyzer developers to introduce their own SnippetTextEdit > extension. The upcoming LSP version is going to contain a slightly > different version of the SnippetTextEdit. > > If my memories are correct, Ada Language Server should use this > SnippetTextEdit to unambiguously communicate its intent here. (However, > Eglot does not currently supports SnippetTextEdit.) It was my understanding as well that they went out of their way to not indicate point location, however you end up with editors doing different things. Maybe the Ada LS should take a different approach here though, as you mention. From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 08:44:28 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 12:44:28 +0000 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 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 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) 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) 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) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: From: Troy Brown Date: Tue, 14 May 2024 08:43:59 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 70929 Cc: Eli Zaretskii , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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. From debbugs-submit-bounces@debbugs.gnu.org Tue May 14 10:17:39 2024 Received: (at 70929) by debbugs.gnu.org; 14 May 2024 14:17:39 +0000 Received: from localhost ([127.0.0.1]:39631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6syG-0005kz-IR for submit@debbugs.gnu.org; Tue, 14 May 2024 10:17:39 -0400 Received: from mail-lj1-f171.google.com ([209.85.208.171]:57463) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s6syB-0005kl-NW for 70929@debbugs.gnu.org; Tue, 14 May 2024 10:17:35 -0400 Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2e5218112a6so47011131fa.2 for <70929@debbugs.gnu.org>; Tue, 14 May 2024 07:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715696184; x=1716300984; darn=debbugs.gnu.org; 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=h5GvSv6ikiXsCd7rTDLaeHVQe/d1Qh1tqjKsu3hU69I=; b=I4GgDU6GzE7olT0+zNc7ifImO2AZgTzc70gsnxsDhmFfu5pZj/9eCf5vTS2Ww/nOvQ YKUen9oRsUxmXdIAr7dmVmKdHXfnozJYUeIENbRdWh2PXHhNgExqlEs96J4Sy1cbbf4f 59HNNAzgZyYPrVAy5nwGM+b+XfFhO6jfRqK7qn+DPmbMWpHlF1JTOuSBm8d8qfxrCFfk yXojFtclgYGsA6kRceFCaH+x0HYMPnta+v5g7jwRssQokHCkhv2JDJZg67CY+sdUJI4u Uucoh1jYFe76VfhDez5YPlU0IVSJF05XtoNpwimz65c4TL3hNsNXBZ4w4muaet7zdb1o qbNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715696184; x=1716300984; 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=h5GvSv6ikiXsCd7rTDLaeHVQe/d1Qh1tqjKsu3hU69I=; b=Ry1+y65fOXI/WYdad+DaIoWAavPYH2DBfwhoVVu4pi7l6vhOdA53jtf1SY39jsnxCG LEzvBT91qV6A+nsf3q1Vfs+9fpRF2p+EGTaLly5+MtqSIpycKVv77kfL0lKx5E5UYvHL 03V1TbnDOG+aupWSWo4rTSspc+VnSCAKEUJ1wxPWl/kAh4Bqjn0DnSYIGFSHMGG4okcm F4FG7jAciyuNnHgpr2hYpKbNL2rNUvNicnq0m5wN2rgJk0PwnAoSExiOzm97FgDuXGsK fT3EU1mlHpvsBVEd5g5RxOO7mF8dIOGgwHfwMHoIORG7B/3l/XgZXtbpSBKj513Km+d/ tA7w== X-Forwarded-Encrypted: i=1; AJvYcCWwryHV3vBvn2BHUgp/WSc60RslkKsQpy44YbC9998vY2JpcMRhhN+7aiQM+Dx2YtbLEtVA2j/WyhsFuzp+AIKJhCey+LM= X-Gm-Message-State: AOJu0Yw1WI5FKeYKcOJPwJUBrnE0cXon75lkSfevQCGTEWNwelRp74U/ Jo1eBA3BFZ95FPAkW/MNAjAvGJKx3NOrvZDQOTEbS2qAR9+H2TA/3Jk5saOvVFZvijYqT43sY8/ Jx2pVK+QjUMFHx2THXh2g9tA1j3I= X-Google-Smtp-Source: AGHT+IFEMLTNUq6x3UykWjbNiqdPmMRFUPe/PPSngo8PKbn19pUYwzMDMYWlUXTZoVbgagK31VPkzjykMO/4/tVan3A= X-Received: by 2002:a2e:91ce:0:b0:2df:1e3e:327f with SMTP id 38308e7fff4ca-2e52039bcb3mr90674381fa.38.1715696183900; Tue, 14 May 2024 07:16:23 -0700 (PDT) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Tue, 14 May 2024 15:16:11 +0100 Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: Troy Brown Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70929 Cc: Eli Zaretskii , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, May 14, 2024 at 1:44=E2=80=AFPM Troy Brown = wrote: > 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. VSCode has its own mini-plugin for each language (sometimes not so mini). Akin to a major mode, but has somewhat less than 40 years of work put into it. In that aspect, it's not exactly a model of what LSP purports to bring: a language-agnostic solutions. So I don't model Eglot after VSCode, and have never done so. I model it aft= er LSP and my knowledge of Emacs. That's not to say that I will ignore if you show here whichever solution VSCode uses for this (if anything). > > 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. Sure, a workaround is not a solution, by definition. But the way to implement the solution in a LSP language-agnostic way -- which is what eglot.el does -- is murky right now. To gain confidence in any approach , I'd ideally first have to have unit tests running on say, 5 servers that support OnTypeFormatting. Code up those tests in test/lisp/progmodes/eglot-tests.el. Verify that the "after the point indentation" indentation cases all fail currently for those 5 servers and the "elsewhere changes" cases all pass. Then, get to coding a solution. For a successful solution all cases should pass. This is non-trivial work, so I'm not rushing to get started, especially since the electric-indent-mode workaround is pretty decent. For some meaning of "decent", at least :-) I find it relevant that so many users (including me) who are using OnTypeFormatting and never noticed this bug until today. But if you're interested, you (or anyone) could help get it started by surveying servers that support OnTypeFormatting, documenting how to install these 5 servers conveniently in a GNU/LInux system (perhaps a Docker image). This would make headway with the essential tests. You're even more welcome to write the tests yourself. As to the solution, maybe it would end up being something that relies on the status quo behaviour of the majority of servers like e.g. knowing that the "before point" indentation edit is always the last one (I'm just conjecturing here, no idea if don't know if this is the case). I don't like this kind of solution. Or maybe the solution is super-clean and is just about asking `replace-buffer-contents` to use the equivalent of `insert-before-markers` and proving it doesn't break anything anywhere else. Or maybe we can scale this up to the LSP folks so they help us understand exactly how this should work and maybe code it up in the standard, so serve= rs behave predictably. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Wed May 15 08:58:44 2024 Received: (at 70929) by debbugs.gnu.org; 15 May 2024 12:58:44 +0000 Received: from localhost ([127.0.0.1]:42205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7EDU-0000l8-Gn for submit@debbugs.gnu.org; Wed, 15 May 2024 08:58:44 -0400 Received: from mail-ed1-f52.google.com ([209.85.208.52]:57488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7EDR-0000kz-NA for 70929@debbugs.gnu.org; Wed, 15 May 2024 08:58:42 -0400 Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-56e56ee8d5cso1882551a12.2 for <70929@debbugs.gnu.org>; Wed, 15 May 2024 05:58:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715777914; x=1716382714; 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=A11jVMOGS3/nHVji5l5OHARBE+ms/tovQdP/UhN3sW4=; b=bYXy4OdVkWge43qQZ/gcvurg8SVcu9qkQlsMaHfDWG/xXZJ6Hfw/QfrBuHLRVRhaW+ uHCIwXT6fHqr271B21qCFOfJ1cMZAw/dHn1cLuFw91hAS6dm7ODoRHPG7YlyBYn6sCRd kgjjSpcYymsCx8RDNjWe2lUmPRKZGFK9fm9u8z6Tt6HuJ4CNj+y6mzq1ayJxFOjU6J4g Jieg7D4qPMBby6vWB95bwu1BBBQsMpigQ427svjSzxfjJBP7YFdMRI3YhDx35p1RxKXM J3703FqABQv2mSd0cjyfiUWC1Rwz+/s9mPoTPvLSYoCOcwUk+LHVIw75nT8d4uXgkkuC EDJQ== X-Forwarded-Encrypted: i=1; AJvYcCXW46wyvlkp0VwwyjqArx2NGogf4em8jl24Ir3qzVf7qeHOmQxdiHL3r9BHuwk08dz8OHeehZwhm9OAibUbsdeRINMnGvE= X-Gm-Message-State: AOJu0YzXkaUU6uQ44X5i2MfD1KeRU0mt3fwZK8H0bxNobyPOMjoXCFEs 3RbL7SdXWv1H160AJ02i8V9pRGZdhvuYYHYaUG7ib6Q7eFu3TTJTiB0gsiMWPHY= X-Google-Smtp-Source: AGHT+IF/YVNSQc+lPjVnwQXVK/Gc3csOjTWfX/lnVu66RhqWDOKAlSpHB8slyerCjM6tFduFoQxQcw== X-Received: by 2002:a17:906:6716:b0:a59:9e02:68fc with SMTP id a640c23a62f3a-a5a2d5f193dmr1051683266b.44.1715777913799; Wed, 15 May 2024 05:58:33 -0700 (PDT) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com. [209.85.218.42]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a691870absm398717066b.124.2024.05.15.05.58.33 for <70929@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 May 2024 05:58:33 -0700 (PDT) Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a59b178b75bso135828466b.0 for <70929@debbugs.gnu.org>; Wed, 15 May 2024 05:58:33 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCX6bqZ1kNyA5/r7ss9gFgPDN/RsznFXlYAaJHdcrhQjAauUPH9JGxU6Q6+BVsp0Ssf7qQwlDvZJfkHMQX2VDqrqubimEIk= X-Received: by 2002:a17:906:2b81:b0:a59:bfd3:2b20 with SMTP id a640c23a62f3a-a5a2d6a3894mr1052295766b.67.1715777913428; Wed, 15 May 2024 05:58:33 -0700 (PDT) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: From: Troy Brown Date: Wed, 15 May 2024 08:58:22 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 70929 Cc: Eli Zaretskii , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, May 14, 2024 at 10:16=E2=80=AFAM Jo=C3=A3o T=C3=A1vora wrote: > > VSCode has its own mini-plugin for each language (sometimes not so > mini). Akin to a major mode, but has somewhat less than 40 years > of work put into it. In that aspect, it's not exactly a model of what > LSP purports to bring: a language-agnostic solutions. > For another datapoint, lsp-mode behaves the same as Eglot in this regard, so Eglot is not alone in this behavior. Oddly, the two have very similar implementations for applying edits. I've also filed a bug report with the Ada Language Server developers: https://github.com/AdaCore/ada_language_server/issues/1197 From debbugs-submit-bounces@debbugs.gnu.org Wed May 15 11:11:47 2024 Received: (at 70929) by debbugs.gnu.org; 15 May 2024 15:11:47 +0000 Received: from localhost ([127.0.0.1]:42612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7GIF-0002Xp-HX for submit@debbugs.gnu.org; Wed, 15 May 2024 11:11:47 -0400 Received: from mail-lf1-f51.google.com ([209.85.167.51]:52334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7GIB-0002Xe-U9 for 70929@debbugs.gnu.org; Wed, 15 May 2024 11:11:45 -0400 Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52388d9ca98so2337324e87.0 for <70929@debbugs.gnu.org>; Wed, 15 May 2024 08:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715785836; x=1716390636; darn=debbugs.gnu.org; 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=ZmKJliTQnnC28bz3DwvKgjjvk56/+FN7DCmDYcgzKLA=; b=DwVxJCFpTXmltl0/4DBhvXBF+VPVNfHYDkuKXonrOcIl8xvAvQRuxsK8U68keCaSeP qejNC+WC+oFZ4LYuBydapIJnhFFcW+gvw55rsMIFJWQ/n6fQeDDlHIkM56a3BnHFKfez FgeO7sDvDOocGSIIMV6TDy0j3+b9VNYy+rDxrmU554YJ7QLk98jV5pFr6kwZGpeKxDbk UAuubJIRRNqGUqlOyQh8UUEvdPsFriFxlv3kgFHbZuFrne1eTUATDWNz2erAD2odte6K taBNKD0WDdYsgKDjJO1A7n41VQsT9R/qvGRhPyjvV8nBUcfk+IN8iOoOuXuowPnD6tfQ MXlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715785836; x=1716390636; 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=ZmKJliTQnnC28bz3DwvKgjjvk56/+FN7DCmDYcgzKLA=; b=ZFks+0TCRvhq916fjrbUpmOhk+K+MvWz6OdH+oR4KlfTJPyVr/ARat08J1zlps82Jd QwZweERJCp1X2pz7uRRJrDGLECiY1d9R3gr+OvM4OKNwAoBRD6bTru+IT+JK5vHUvTK3 I/hy1rtwAjSftDbqnUfYSOggZdcv8i00ZRhekrnBy863I6qrhLZ8POufVtZBKzx8Q+Tn vVySQnQwvo/uKI8fTD5H9Wb+O63RDBdilWhbe0SRoddeidSUxIevuEoegTvy4zaOzXHT 4UyOmcTLdxTBt++FO1+Skv1sM4YVvedVCuRCypw8o6iHyEPyDE+JT6SoJUye37kcJUeZ XMrA== X-Forwarded-Encrypted: i=1; AJvYcCUJhm4JRy/A6n9f1XaowV3kEyjglWKvpxx8QRN6JA11OemeQrIJLlXztR2aghdNqEFmTG+pyoibT08qzsGv2YqT5H1uYlg= X-Gm-Message-State: AOJu0YxxWJWZGO5a5KkNMGiFEE+yKAprF2Z3WPR5d47rEXcTHqyWLN/G TQsswWgVUFatPerVlLIg362bO1rziz1nNKq5PJYkmlZtc8WoE/ksUhdSPKLJq6fcuUt4Hw4jxj4 qw3RvMQdzYpVmu1A574Fp733m59I= X-Google-Smtp-Source: AGHT+IHcn1piIOhh5ihRgys6i7oyt3bZ2evHEd5CG9T5822UewDNHWjmTHJFO0RmvwYl0mjjLSmuvbrs34l1fL5nMO0= X-Received: by 2002:a05:6512:1087:b0:523:78de:11a3 with SMTP id 2adb3069b0e04-52378de12bbmr5132589e87.2.1715785835811; Wed, 15 May 2024 08:10:35 -0700 (PDT) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Date: Wed, 15 May 2024 16:10:24 +0100 Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: Troy Brown Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70929 Cc: Eli Zaretskii , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, May 15, 2024 at 1:58=E2=80=AFPM Troy Brown = wrote: > For another datapoint, lsp-mode behaves the same as Eglot That's good to know. > Oddly, the two have > very similar implementations for applying edits. Doesn't suprise me that much. I know I wrote mine from scratch ;-) but the design space for this performing feature isn't infinite. I've also hea= rd unconfirmed reports of "inspiration" taken from Eglot, no idea, if here or elsewhere or true at all. But if true, I think that's great too. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Mon May 20 23:35:33 2024 Received: (at 70929) by debbugs.gnu.org; 21 May 2024 03:35:33 +0000 Received: from localhost ([127.0.0.1]:46594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9GHk-0001DV-TV for submit@debbugs.gnu.org; Mon, 20 May 2024 23:35:33 -0400 Received: from mail-ed1-f41.google.com ([209.85.208.41]:54320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9GHe-0001DP-JC for 70929@debbugs.gnu.org; Mon, 20 May 2024 23:35:31 -0400 Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-572e48f91e9so9022295a12.0 for <70929@debbugs.gnu.org>; Mon, 20 May 2024 20:35:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716262515; x=1716867315; 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=0Q39Ip6Y8SvSojDXppTXyG7yUz1mVLxviiwyr8WzofY=; b=DLI70uzoG4wbdY9kLz5MqQl07mjZd5jo6ATlDLcYz8sPU9iHhko+2L+qxaRCCebJHo bH1H4NwAdXtC0MDjPlXX6zW6MMSGb0h/9iniO6NEjYwZKDkZ/wfjIc3x7Rd6mzdTqq4d wzAeke/Jbp+dZGTXVTSPts3FAgzhoP1LZQYJV40Auma7yzBs1FdAn+V4XwC69EC7q0Ms feH5ceTcf789Etz6bTm0dJTnFmsv0Mf7aDT4O5K0mps1mAqEiyiX4r98jBs7zl/5VmG4 0mG6S9ZubgJimgh32VmXTdqxVh3m1jms9N069MlDztCu7lC4HD2+ecdli5yTKStUznEm SVvA== X-Forwarded-Encrypted: i=1; AJvYcCVQ6xfpNW9RN6LB98lK7CDI2hD6xNk6tdcs5Xr9rtu9F7DxPa999lL8aUqt3IX101htHJFy5LhMOAv33mcsBYZNtKH5kkI= X-Gm-Message-State: AOJu0YwFGPpkGDnJpzPUqVYG2sP2w9bqXDoExu71AtfqJ5YI9mfgBqXa w2itCwVL31YrFKrsSnAV3OTaJi6PEGZkdfzIOexQ0Oz07h5Cg4NHcSxO9Ph27t0= X-Google-Smtp-Source: AGHT+IF2bgdRi9eGRW2e1BLVFloWn/yMpy887MYdaUnS+CLC6w5RARGSq30JtPsW1b3MOZlAoEkd9Q== X-Received: by 2002:a17:906:aec2:b0:a5b:53e2:519e with SMTP id a640c23a62f3a-a5b53e26b4fmr1061561266b.26.1716262514755; Mon, 20 May 2024 20:35:14 -0700 (PDT) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com. [209.85.218.47]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b01602sm1562138066b.147.2024.05.20.20.35.13 for <70929@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 May 2024 20:35:13 -0700 (PDT) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a5a88339780so778969566b.0 for <70929@debbugs.gnu.org>; Mon, 20 May 2024 20:35:13 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVq239ztgqSJM1h+d9voX/I4eRKARHLi5g+anbbfDGFO541H+5D7jWMIjrMxMat9VzDbNxVHlpkDMIdlAw1Z6Q369eaMlc= X-Received: by 2002:a17:906:c111:b0:a5a:889c:1e38 with SMTP id a640c23a62f3a-a5a889c1ebbmr1488968366b.39.1716262513774; Mon, 20 May 2024 20:35:13 -0700 (PDT) MIME-Version: 1.0 References: <86seykx66p.fsf@gnu.org> In-Reply-To: From: Troy Brown Date: Mon, 20 May 2024 23:35:02 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 70929 Cc: Eli Zaretskii , 70929@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, May 14, 2024 at 10:16=E2=80=AFAM Jo=C3=A3o T=C3=A1vora wrote: > > So I don't model Eglot after VSCode, and have never done so. I model it a= fter > LSP and my knowledge of Emacs. That's not to say that I will ignore > if you show here whichever solution VSCode uses for this (if anything). > According to the Ada Language Server developers, clients usually use a minimal diff algorithm for applying edits which allows the cursor to be put at the correct location. Apparently, this is what VSCode and GNATstudio both do. According to them, this is an issue in the LSP client, not in the server. See the issue response here: https://github.com/AdaCore/ada_language_server/issues/1197