From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#61726: [PATCH] Eglot: Support positionEncoding capability Date: Fri, 24 Feb 2023 11:43:18 +0000 Message-ID: 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> <87lekodxja.fsf@gmail.com> <83a614p4sh.fsf@gnu.org> <87cz60dus9.fsf@gmail.com> <835ybrpnqj.fsf@gnu.org> <87y1oncz09.fsf@gmail.com> <83r0ufo3uc.fsf@gnu.org> <87356vbf0b.fsf@gmail.com> <83pm9znw0i.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="4400"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61726@debbugs.gnu.org, Augusto Stoffel To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 24 12:44: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 1pVWUo-00012Z-Gx for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Feb 2023 12:44:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVWUf-0006xG-1N; Fri, 24 Feb 2023 06:44: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 1pVWUd-0006wO-2D for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 06:44:03 -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 1pVWUc-0003fW-CH for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 06:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVWUb-0006bA-Sk for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 06:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Feb 2023 11:44:01 +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.167723901825324 (code B ref 61726); Fri, 24 Feb 2023 11:44:01 +0000 Original-Received: (at 61726) by debbugs.gnu.org; 24 Feb 2023 11:43:38 +0000 Original-Received: from localhost ([127.0.0.1]:36131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVWUD-0006aO-Hq for submit@debbugs.gnu.org; Fri, 24 Feb 2023 06:43:37 -0500 Original-Received: from mail-oi1-f178.google.com ([209.85.167.178]:42985) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVWUB-0006a9-Ed for 61726@debbugs.gnu.org; Fri, 24 Feb 2023 06:43:36 -0500 Original-Received: by mail-oi1-f178.google.com with SMTP id bh20so15292401oib.9 for <61726@debbugs.gnu.org>; Fri, 24 Feb 2023 03:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677239009; 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=8RnYHR7JsKTyt3RjZzfGdI2X0t2utJljUOWrHnNCJuA=; b=og9+zlnGNlldBF1v9+fh1KRFERiQcIY4RH81eiB7xo4biaz95ebXKk55JNbdaQHsf0 7TomUlyD4LZMFqLj2O/2/o6xScrcZB2fn9SYFeWjdiE6TThmtHJ5OBaROPnhHd3DivTa hHRkxcCEKPyMbaG9M3fv7gq1j2iIfVKooJAgZEvRuD/6Aa+mowMIWOfJ1sVo2cBBygnP vSZSXW3ghBTWHRMsseBsT5lj2gIOwe03FFxzPeKoJ9rx5G7VXTsYUXG8anBcaTHLmHxd WE0ZzuxQ1wiS40ME4CN8xZySzkmMd/CrS88cZqNT3ulW/n1wHEefEPfYvR/7eglpo5Wo UFGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677239009; 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=8RnYHR7JsKTyt3RjZzfGdI2X0t2utJljUOWrHnNCJuA=; b=M/jMrBK5ZZo+17AwQG+cMT80LQfznaM+4rLSHkwEOJMSIbUKiUZK7JdaFck0wEibEc r+tlcnW35TlQBR5XXjKZRjP2mVQnW6jjl8sMdH2VbXQkB4B0sbfHZ5esS8wZZnzfn2qr NTcmZK4i6SbyqFXGf9AuQ5jZwUXJDBshJtpBI7JBL8U3RO/06uKVVBOPkWMKuv9tFQud E0WDB5gZ6k37eLhizRS5ztUoOXNoGffaSbC8BrFZVgVh99FBa7ggt97qDI1oAk2GcYkU t7EJP2tPYI+FUlSZOENtJePCLyntLeiKLlKiotYCL23UIYofKYdqWDG5tLfJXYT9R/GW ppTQ== X-Gm-Message-State: AO0yUKXCM1XnDBgnvnw25aVbtnQp+80QuccpIwj8G6R5YJ6cURCskTRQ Z7bd8OtWEhwDN7LhfsgM097/ylgsBh7zROOXhDs= X-Google-Smtp-Source: AK7set9cesyy8hiyAyWa8CRw2BL8h4nHsmJQ2uaARtIO/9M2KQklxWf9ctJcF0/SbWF62vvD3i9BlTJK2lrsxvsDYRU= X-Received: by 2002:a05:6808:10d:b0:378:8018:ce36 with SMTP id b13-20020a056808010d00b003788018ce36mr1011759oie.8.1677239009625; Fri, 24 Feb 2023 03:43:29 -0800 (PST) In-Reply-To: <83pm9znw0i.fsf@gnu.org> 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:256569 Archived-At: On Fri, Feb 24, 2023 at 11:27 AM Eli Zaretskii wrote: > > > From: Augusto Stoffel > > Cc: joaotavora@gmail.com, 61726@debbugs.gnu.org > > Date: Fri, 24 Feb 2023 10:15:48 +0100 > > > > >> -(defun eglot-current-column () (- (point) (line-beginning-position)= )) > > >> +(defun eglot-current-column () > > >> + "Calculate current column, counting Unicode codepoints." > > >> + (- (point) (line-beginning-position))) > > > > > > Can we please take this opportunity to get rid of the confusing > > > "column" terminology? As became evident from this discussion, we are > > > not talking columns here, we are talking offsets in characters from > > > BOL. So something like "pos" or "linepos" or "line-offset" should be > > > better. > > > > > > Jo=C3=A3o, are you okay with such a sweeping change in all of eglot.e= l? > > > > I like linepos, if Jo=C3=A3o is fine with not making the absolute minim= al > > amount of changes to the code. > > Jo=C3=A3o? eglot-current-column is a user-visible function. would need obsoletion aliases. Are you sure it isn't better just to add some clarifying comments? I fear for my ability to recall details about this code with such a sweeping rename, accuracy-improving as it may be. So it's a balancing act, your call. > > > >> + (tab-width 1) > > > ^^^^^^^^^^^ > > > This last part shouldn't be necessary: we should move by characters, > > > not by columns. Why is it necessary? > > > > Maybe Jo=C3=A3o can clarify, but I'm pretty sure this is there to suppo= rt the > > UTF-16 way of counting offsets, so this ideally should move to > > eglot-move-to-lsp-abiding-column. > > Then perhaps the UTF-16 way of counting offsets should be changed as > well. I've vc-region-history'ed it to: commit 2cf7905887f2137869f44c3383a55636e38b4b81 Author: Michal Krzywkowski Date: Mon Nov 19 21:22:14 2018 +0100 Treat tab characters as 1 column wide in position conversion functions Fixes https://github.com/joaotavora/eglot/issues/158. * eglot.el (eglot--pos-to-lsp-position): Call eglot-current-column-function with tab-width bound to 1. (eglot--lsp-position-to-point): Call eglot-move-to-column-function with tab-width bound to 1. Following the link, I read this there: "This is because move-to-column and current-column count each tab character as tab-width chars." And, as far as I remember, at the time we were indeed using move-to-column = and current-column. But now we aren't anymore. So maybe, just maybe, this can be removed. And the full test suite must run afterwards. And then probably more tests should be added. Jo=C3=A3o