From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felician Nemeth Newsgroups: gmane.emacs.bugs Subject: bug#70929: 30.0.50; eglot--apply-text-edits prevents point adjustment Date: Tue, 14 May 2024 07:30:04 +0200 Message-ID: <87le4d55b7.fsf@betli.tmit.bme.hu> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18173"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: 70929@debbugs.gnu.org To: Troy Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 14 07:32:23 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 1s6klz-0004bd-CL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 May 2024 07:32:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6klh-0002VF-1E; Tue, 14 May 2024 01:32:05 -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 1s6kld-0002V1-TC for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 01:32:02 -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 1s6kld-0001qU-Cs for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 01:32:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s6kle-0007tH-7R for bug-gnu-emacs@gnu.org; Tue, 14 May 2024 01:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Felician Nemeth Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 May 2024 05:32:02 +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.171566467630301 (code B ref 70929); Tue, 14 May 2024 05:32:02 +0000 Original-Received: (at 70929) by debbugs.gnu.org; 14 May 2024 05:31:16 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: (Troy Brown's message of "Mon, 13 May 2024 22:15:07 -0400") 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== 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:284991 Archived-At: 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.)