From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#61726: [PATCH] Eglot: Support positionEncoding capability Date: Thu, 23 Feb 2023 19:52:41 +0100 Message-ID: <87lekodxja.fsf@gmail.com> References: <87a614g628.fsf@gmail.com> <83cz60r7hu.fsf@gnu.org> <875ybsfvtj.fsf@gmail.com> <831qmgr17p.fsf@gnu.org> <87wn48ecdz.fsf@gmail.com> <83v8jspgnr.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="18617"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61726@debbugs.gnu.org, joaotavora@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 23 19:56:14 2023 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 1pVGlJ-0004b5-Fs for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Feb 2023 19:56:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVGiH-0007hd-4c; Thu, 23 Feb 2023 13:53:05 -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 1pVGiG-0007e6-0g for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 13:53:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVGiF-0003Og-Od for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 13:53:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVGiF-0008Is-KI for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 13:53:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2023 18:53:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61726 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61726-submit@debbugs.gnu.org id=B61726.167717837231858 (code B ref 61726); Thu, 23 Feb 2023 18:53:03 +0000 Original-Received: (at 61726) by debbugs.gnu.org; 23 Feb 2023 18:52:52 +0000 Original-Received: from localhost ([127.0.0.1]:35304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVGi3-0008Hm-Rl for submit@debbugs.gnu.org; Thu, 23 Feb 2023 13:52:52 -0500 Original-Received: from mail-ed1-f47.google.com ([209.85.208.47]:46841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVGi2-0008Hc-Sw for 61726@debbugs.gnu.org; Thu, 23 Feb 2023 13:52:51 -0500 Original-Received: by mail-ed1-f47.google.com with SMTP id x10so44974263edd.13 for <61726@debbugs.gnu.org>; Thu, 23 Feb 2023 10:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xaj8Jz8+U++pdmDlbhsicx3uhZr6UxTchjKeGqDIWKk=; b=RLSxqCFN/LNdT7gl9cxI+yQYCWgvsuPZw1iUU1i75kj3CBVt3j9CECcupvq/YnMAM7 Eisc7W8j1XcPxoG+cC2M1r/89UvgJZqMFEJt2oSlX4+F0GSiTHHR4C6PMmQ9WQbgN0OW 8uNuf2jUIKeUsOm3i4bjGK5iSu02G8NeEAkJawonSDZAuiGtaEBIG5DiG31AhYhM/PFz jzHAWkkOkI+thUvjhMMJzjEWKKXQZ5Mhyl7n2pz9ro5hL1ahXEqmKJbLSMc1Xt7OGkea WZST9Dfcr3rYz6HY9VT5n3X0wkqvgbDZxHkirxqWk5WehKUJc4/46IN2jC9ZjjMGM8oR W3jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xaj8Jz8+U++pdmDlbhsicx3uhZr6UxTchjKeGqDIWKk=; b=50dkyghx5y05KbP1BdB4QoVOBAee4Z1nXJyjGRLFnvaF7Ik/o0ixtMA0lKAxoRGkRj dYNoVoNrTE/BJ22WqDJI4gvtOvWt5Z1IgfreY223AhcccN2YJkQkgyV/IYOiYyHBXUqU Zu5gSn3wwFhbmg1PD9eRmCF934GOklO1g5sFidhNLECnmCab7/oNl2gDntbaziNKKOZb T4XM+VWz32b3BYsGgssTbZCPEr4fPAkKrIZCZR6XRNwrxdUC3Ur5eXPcSwKiYU5bSbjg BTVmImdRFwq07aqB+/IVjxAa8DTRvI8hstlYeLPs7wc1D6UZe02jCGWJj4hN2fdPl5tq qkVw== X-Gm-Message-State: AO0yUKW+IacOM1m7Ls7fGFmFITRMm1UywlLcOMeSIemlrvWU4LtI5/MP /YfFKbvBMnjr0Q+bCE8R8p8= X-Google-Smtp-Source: AK7set+beu2j1z2WN5IXDd1yWbpoNlwLWGt9WzEPFc2fqNj+JfkQPeWg8a1UzWwuXt05kC+ekK5DAQ== X-Received: by 2002:a17:907:7295:b0:8af:3930:c390 with SMTP id dt21-20020a170907729500b008af3930c390mr32149759ejc.62.1677178363615; Thu, 23 Feb 2023 10:52:43 -0800 (PST) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::6fd0]) by smtp.gmail.com with ESMTPSA id gs23-20020a170906f19700b008ba326ebaffsm7719074ejb.191.2023.02.23.10.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 10:52:43 -0800 (PST) In-Reply-To: <83v8jspgnr.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 23 Feb 2023 17:04:08 +0200") 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:256514 Archived-At: On Thu, 23 Feb 2023 at 17:04, Eli Zaretskii wrote: > Then why does Eglot want to know the column at all? In the Eglot context, "column" simply means "offset since the beginning of the line", where "offset" can be counted in one of three diferent ways: codepoints, bytes of the UTF-8 representation, or bytes of the UTF-16 representation divided by two (a.k.a. code units). (Number of cells occupied in the terminal is _not_ one of the ways to count "offset", thankfully!) I don't think "column" is a particularly confusing name here, but if you want to rename this, now might be a good opportunity. >> If you look carefully at the Eglot code, you will see that >> `move-to-column' only appears in the code pertaining the =E2=80=9CUTF-16= way of >> counting offsets=E2=80=9D, which >>=20 >> 1. is old and I didn't touch in this patch, >> 2. seems to work correctly, despite looking suspicious, and >> 3. will not be used anymore when both Eglot and the LSP server supports >> the positionEncodings capabitily. > > Positions do not necessarily transform to columns easily. So, > depending on how Eglot uses this information, we may or may not have > problems. > > In general, reporting coordinates in columns between programs is > problematic. We see this in many cases, starting with spellers. Yes, I agree this is problematic -- as soon as you leave the wonderful world of UTF-8. The point of this patch is to stay in that wonderful world as long as the server agrees to it, which I hope will become commonplace.