From unknown Fri Aug 15 17:54:49 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#61529 <61529@debbugs.gnu.org> To: bug#61529 <61529@debbugs.gnu.org> Subject: Status: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Reply-To: bug#61529 <61529@debbugs.gnu.org> Date: Sat, 16 Aug 2025 00:54:49 +0000 retitle 61529 30.0.50; tree-sitter: weird off-by-one error but only in css-= ts-mode(?) with `treesit-node-at' reassign 61529 emacs submitter 61529 Mickey Petersen severity 61529 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 03:31:14 2023 Received: (at submit) by debbugs.gnu.org; 15 Feb 2023 08:31:14 +0000 Received: from localhost ([127.0.0.1]:57673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSDC5-0003s6-S8 for submit@debbugs.gnu.org; Wed, 15 Feb 2023 03:31:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:42048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSDC3-0003rw-Kf for submit@debbugs.gnu.org; Wed, 15 Feb 2023 03:31:12 -0500 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 1pSDC3-0008WF-8L for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 03:31:11 -0500 Received: from mail-am6eur05on20713.outbound.protection.outlook.com ([2a01:111:f400:7e1b::713] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSDBx-0001N9-Er for bug-gnu-emacs@gnu.org; Wed, 15 Feb 2023 03:31:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GD3HThCvwUXU9Dnun8CRlkROkn3f0jkoWRbeGJHnYOHumg4KsO7K3tUc7ag7g/8bmqBc87GyBqyI7nqasxKHkMB7by37KPdLX0DGrkAXZcHoSp44cAV5j2HudOjbtQmyeW8vdAjTCe7cipXUfEoyja9/mDQL3EtnmEM+XMsHe2c42HobULz94wDVnzBxh+fn3F5ia/8NREUeRNYuWMn6SrabbITZdRJR2RVPpZf1Y/48v7yNngdc3OI3FA5QjjSuHV5VEkZ7RRcyCaCsp3oez8FNuRyUTsDP7s9XJfRzAwwyRn3+1NhayD97/OrCWGmoMzlP3Sh50YW9NJ2kXqtRhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=em37R2IahNVWdyeUTbI0RwTc8Vr/rAozOrBFRuyBTM0=; b=YrrCEspLg9ZytWqGFY0AX2Hdd3feAqbAhM1nDuM5Q/6qAwCvb0jtoy6b3nccq84a9lLl0wtHtSTtQbO8RZX8+wiX/2v5cDqXMZbs91qt1gjpPq7j1OpT6EUpOhDPBshAQkQOhc+gUd91JI4ndKGLIL2D5HkGzQ5Fy33sa5mjLIYvq86BIdvkLN4EYEWRCbOevcsg+tzpxWNLHc0Jq54G8THyDg60G3A0z9K0X/AL0r3Ez4/q/LF91fOiR8RwSwfBtZZorijzGCPE0ZDr6u6qKXquLmKoCNaZzFGG/MXggN6onnKoAU5tPsDki5EaOzscWiF8IeeWKXSqff263itsrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=em37R2IahNVWdyeUTbI0RwTc8Vr/rAozOrBFRuyBTM0=; b=psWl7mdKJi82espuiM9NJKj4FovgiQZIdt/9ije4YiF/gxqnTPdPVLL24/oS1DwmeuC4UOTiW1da2NPJTuDRvolHnnhXvFjyNNWXJiDI7+CJCvjPiYw2a8oi6NmLjIDFXofk0a7qAprdAbdQ57i6XETf8rX3wRf0s+ZcTM4HdZw= Received: from LO2P123CA0056.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::20) by LO4P265MB6217.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:279::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 08:25:58 +0000 Received: from LO2GBR01FT009.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:1:cafe::fb) by LO2P123CA0056.outlook.office365.com (2603:10a6:600:1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26 via Frontend Transport; Wed, 15 Feb 2023 08:25:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT009.mail.protection.outlook.com (10.152.42.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12 via Frontend Transport; Wed, 15 Feb 2023 08:25:58 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id EBA8B114002; Wed, 15 Feb 2023 08:25:57 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1676449557; bh=XCm8UgugyTeFh/CZpt9ZCEi/s1rlU1v4KbcYOe6ET74=; h=From:To:Subject:Date:From; b=W7qHgFpHlgbT0J0/DMde7tljFrJeBEgL5iKPVziWSjqf6df1Y6SaSEYTOZ2+gnEIs ggT+6WxBMCRlJiTekjiiYTjIa4hU4CbIX/HrFdjcoM+m97XAsCcRFNWsUWuv8q8p/y WHmRpt7Txh7+AxhZNCzi9G8NS7//E7fSf0ZNF3To= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00, NO_RECEIVED, NO_RELAYS, TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.2 From: Mickey Petersen To: bug-gnu-emacs@gnu.org Subject: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Wed, 15 Feb 2023 08:25:53 +0000 Message-ID: <87mt5fjpwu.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT009:EE_|LO4P265MB6217:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 6db4a613-6a04-4297-7ec0-08db0f2e43bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3irp/9FkzeS/4M0fhWGOy0XS2X87tb/07Vv/um7kEnDfcH3b6siY7GxrPdWKAZAOhoeZYSXgFqE4oCZ+OAG3jEVrdTSj7qpcx90cPyE+sb6+DrYiLGcOhx8rIv3aVGp1Ruxra4jGBoGC9demwNUH9kJOXtAky4jMzqu6aQQAxSToz+RdcdF+WDg6rFmv7tCIzHSN6XcsS33zr6Wsgy23cqd9au7grHX5bvZ/w71xvmQ4YFAmls24XVY2kEol2zr4rRDMr9IQXUnHLVSoFj05B1T6BZIGrki5XkYLGsWKpuvwVdD2ndxaPcGkwR/VL5lWinv8S7VHPSmN+KIOaVekdVUFOIgk6XyfY17UU0chD3ki7CSmyAsq90zg+V68iNs1M92JgNsDwqbXvlPTpf7kjvwIaUtuL9YyE/9jhAzB/CJClV5ReCRAVVEXIUbPF2qosgh2aa0BpeS4SXJid0H0YEaupow2Q0ambv206xbgX3Lu/wWtnd0ABwO1qn8km+YwuPZ9abfWMsdyGtWgoeFpdcJwaXKuz83acahxx+PSLpWNlHafDI/DQSCUFaE+OKF93/c4Et1YWdrsT2s8Ohlx1zTA6xKCZTXTv0hQ0hYUXKAg9uG+ViG0CVBBjkRY3hj2xBiDtH4LTBjFg0Ygv4tZ6TcVRtoZrilS0nFnkA5FIvWk0YCM7fql/h+YLsvfgWPpUqTD5XD6++yPndBDHXMhJFndfZX3wr2aqB4OBZNhhEDzfNgONewwBVM0dPcl8ynO4XDRjN+3thqBAHf9UOeyCQ== X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(396003)(39830400003)(136003)(376002)(346002)(451199018)(46966006)(36840700001)(356005)(36756003)(7636003)(7596003)(36860700001)(47076005)(86362001)(336012)(2616005)(6266002)(6666004)(186003)(478600001)(26005)(70586007)(6916009)(70206006)(8676002)(5660300002)(316002)(42186006)(2906002)(82310400005)(40480700001)(41300700001)(8936002)(38230200001)(81973001)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 08:25:58.1927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6db4a613-6a04-4297-7ec0-08db0f2e43bc X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT009.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO4P265MB6217 Received-SPF: pass client-ip=2a01:111:f400:7e1b::713; envelope-from=mickey@masteringemacs.org; helo=EUR05-AM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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.4 (--) Here's a strange one. I don't know where to point the finger here exactly, but I think `treesit-node-at' might have a small bug in it somewhere. Consider this `css-ts-mode' code: a { background: linear-gradient(|210deg, rgba(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); } Let | be point. Engage `treesit-inspect-mode' and you'll see it asserts that point is at '('. OK, so that could easily be a glitch in that implementation, but let's probe further. With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: (cons (point) (treesit-node-at (point))) => (34 . #) Move back one point (cons (1- (point)) (treesit-node-at (1- (point)))) => (35 . #) Move *forward* one and it does, but it gives us `unit' but I'd expect `integer_value` as per the explorer (and indeed the tree.) (cons (1+ (point)) (treesit-node-at (1+ (point)))) => (36 . #) Again but with the TS implementation `treesit-node-on`: (cons (point) (treesit-node-on (point) (point))) => (35 . #) And now we get the right node. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 08:42:32 2023 Received: (at 61529) by debbugs.gnu.org; 15 Feb 2023 13:42:32 +0000 Received: from localhost ([127.0.0.1]:58251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSI3M-00012f-BE for submit@debbugs.gnu.org; Wed, 15 Feb 2023 08:42:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSI3J-00012K-S1 for 61529@debbugs.gnu.org; Wed, 15 Feb 2023 08:42:31 -0500 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 1pSI3D-00082F-C6; Wed, 15 Feb 2023 08:42:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6Kky3g1vQJFp159Qsv3mfSzIRMxsyWeq+FHq1CnNoBY=; b=hDMXyRpZ9oeY ezyWphVbJ3ZL9FMUohueGs0Wc6DvYlPTSdqT6Ibvn/SviNPP4M808z8M0HLvxolQ/WBw2gBTSgFli uY3fTpL86pNQbIBcp06OlfQVAp3yPQ8U5tIReRBJYGUZCNC46D05R/Bb0oAhVE50wkjveJHN7esKv GlgTjjYJRsVLO1tKun7O7nEiBTjaX+B6dAqaExrlm4zOSSWtVbfmtgh9cEROnN+ePSrazsTYfVG69 DfqWVJ5WyACLLRN5gNWj9WsPwaCVlr5cCKQ47Szw8jLi9RS+ZrrAOMzSX5b1pzfxdDaK1D3MNKg2t 4uq8cwRkZZdofjP+r6TkpQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSI3C-0000yz-O2; Wed, 15 Feb 2023 08:42:23 -0500 Date: Wed, 15 Feb 2023 15:42:03 +0200 Message-Id: <83v8k3avv8.fsf@gnu.org> From: Eli Zaretskii To: Mickey Petersen In-Reply-To: <87mt5fjpwu.fsf@masteringemacs.org> (message from Mickey Petersen on Wed, 15 Feb 2023 08:25:53 +0000) Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' References: <87mt5fjpwu.fsf@masteringemacs.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61529 Cc: 61529@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: Mickey Petersen > Date: Wed, 15 Feb 2023 08:25:53 +0000 > > > With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: > > (cons (point) (treesit-node-at (point))) > > => (34 . #) The value of point is the number of the character which _follows_ point, yes? So when the cursor is on '2', point is actually between '(' and '2'. Right? What does this mean in terms of the node that should be returned by tree-sitter? From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 08:52:06 2023 Received: (at 61529) by debbugs.gnu.org; 15 Feb 2023 13:52:06 +0000 Received: from localhost ([127.0.0.1]:58278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSICc-0001OW-8s for submit@debbugs.gnu.org; Wed, 15 Feb 2023 08:52:06 -0500 Received: from mail-db8eur05on2138.outbound.protection.outlook.com ([40.107.20.138]:45152 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSICa-0001Nw-4b for 61529@debbugs.gnu.org; Wed, 15 Feb 2023 08:52:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a5GUMwNTR3agzpaYefjd5L29aHd+40EOss6KPx2YmX/1E9nRvYcnro4hOt+6sqVuYWXnU6+8RbShGhrlVgvbMQ3e+KscVLcP2ApWxvH758usiSGhSjPiCdSAmvTT7A9Tsna/usM+wX6TlecjDmhQ9XbtoHWVu+2ABrdlHB88fZ2pSQHgCw+NkXS8Odg3QdkZdRyiVQ9FCMxZ3eJJG1PwQBg7tEQUz0MTK0InH+TnZ49BIIxK1jXQ3m0F8t7EBjd/ShRGfMHbiAwy8/to6hBQQ88AnT0Xamc/azPNEUQHUNRBlW0JArVEnTuttnwdV+0Rdzjohi9LdXNIPBjWC3b2Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hiclVXuoNL+rZpnvCJLOsoF3CGS0+1aK9prCJqrfgT4=; b=TXESQgyqXrfxYrRqpuutVkUQgQB2wYDfHyo9IkkpVHALD+2EyDR7OY204dd+YarN7M7Rl63JpVpKQAYBnw/HovNTqCU/0KRlBpwkxJi4kb/+9L+AIJu9ekPHNZqyrLAxAcKTF0cv68x5+4HOqgq1ew3b+mYmMjz9C17dlW/e15XjYyv0JDlcHY7xEtmNXZyjbPbA3nIvtIrZcufQg1vNkImWIT+krHdmBBaG8bUK0sEsqchL6jxfALa2cY99MUaoR11c3jxgmD2KZvJLx73GnBIwOJK8UwX7mG/InuAhvCT7/8KDVotY2sPJg24LN1VcCDCPz1Q9+ckSqKqPYhe0aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hiclVXuoNL+rZpnvCJLOsoF3CGS0+1aK9prCJqrfgT4=; b=Fhtvw9yVhsfXCGRPGrLvPsgtEM5qcNST/HvnfhpDFdmmjtjKJppEOe3aNyI8CnGjxW5fZtau5XCaJklQTuPt7SMzG3wHMsfI1VPsQI8+1vwfl0+CKWTe2eWZcftgcndx9Ha7GcIBK9rzo/bZZamPXBOR7zaLTlSZEWBx7k/52oc= Received: from LO4P302CA0019.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:2c1::11) by LO6P265MB6459.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2df::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 13:51:57 +0000 Received: from CWLGBR01FT038.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:2c1:cafe::24) by LO4P302CA0019.outlook.office365.com (2603:10a6:600:2c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26 via Frontend Transport; Wed, 15 Feb 2023 13:51:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by CWLGBR01FT038.mail.protection.outlook.com (10.152.40.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12 via Frontend Transport; Wed, 15 Feb 2023 13:51:56 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 68F8D114002; Wed, 15 Feb 2023 13:51:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1676469116; bh=t0Y4yksmo7H960+A6qqTpFC29uFxBqYbjPoxTqa7Ddk=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=fBg1vs2dOPuPUF03veh4mWUZF5Hotz1/QeIENk4pihBI8MqxfO5eTJh4LfYOA5VLj Qz6ol9aSyJn5QtfUHgoOIePFaitxcs8yycOLHf6l5R5kG7asqU0PstWHuCRfKBeqm+ ZHvELxOlFjJ0Rpc5KyxYMk6xbgxl7wCfvW/0qFHQ= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen To: Eli Zaretskii Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Wed, 15 Feb 2023 13:42:51 +0000 Organization: Mastering Emacs In-reply-to: <83v8k3avv8.fsf@gnu.org> Message-ID: <87h6vnjath.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CWLGBR01FT038:EE_|LO6P265MB6459:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 68c36bbd-b9b2-47c2-b3ac-08db0f5bcd87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KIEQkURcbEgPI4kKso0GO9s7wcIm8nWFNNrEttXuEtj8womTp2ghGA/GlP2DyWrRf8hjX31pDS6k6BwST0aLlh1cNqe1od8zDj0q1Gu5mOZAkcWpA+lJJlz3Gq3OCvjVrFwfrYQsFQVYbmOitokozREnpbNoLqOmvuA9De7THjCRNu3iPwAYRLkYCQ7w08sGCtm/FO8IRlpVEzF9s/z42f7gapfPY43XIZr30gFn23vUzqQyPzFL+HvdHvNyb7jftSUmfm9AlWPuH40Et8jarXl4D5UiV0ZeHYhUQBQr2h4J/zj2d+zEEqXeO/0tbs5PtA28LPYwgbj4dfhPGFTwreLY70F/d5/UI7zCz9V9pFG6Udl2nSJHJOds9cn3Bg39l9SK/yhz7PH2Wc4Ddm3t/uSpk8gF/5YDfmtmGAZv8zj9ON7hTbGXA3f4xpw1Cd1HiBPuBXyZ82SyyJbrYjkvYCg/ZgxtnBAuJC1+6dsOgnHv4ihL3/WlaXmsnZNpfF1IF0d5vHgBnFZWKpCWG8/eSm19rq6X1SyZagQTAXGbzIiLFmpvcsWsCZhSe27hV0U4IdXLfAv+XjqM8aDDazj/xjF1lW049C6S4E4rig2Q9QswvwELlaVnECNk84ATNIjFMSgiOcDe+WiNRXw2Dn37e7aerIIOSAkvOY610uEM3bnofxuTwfjZUfEFV3Nt/dZEnIhEjgbFCG6UZAXIVCAhsJiZzfk1XzBX3+3lpOnqQbqSZkOXwsPDC0C9+ve+i+y/fSfz+CVWA7AGMdk5WqV7Iw== X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(396003)(39830400003)(376002)(346002)(136003)(451199018)(46966006)(36840700001)(36756003)(316002)(36916002)(42186006)(478600001)(26005)(6666004)(5660300002)(2906002)(70586007)(4326008)(41300700001)(70206006)(8676002)(6862004)(8936002)(186003)(86362001)(7636003)(36860700001)(7596003)(40480700001)(356005)(336012)(6266002)(2616005)(47076005)(82310400005)(38230200001)(81973001)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 13:51:56.7345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68c36bbd-b9b2-47c2-b3ac-08db0f5bcd87 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: CWLGBR01FT038.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO6P265MB6459 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: 61529@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 (-) Eli Zaretskii writes: >> From: Mickey Petersen >> Date: Wed, 15 Feb 2023 08:25:53 +0000 >> >> >> With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: >> >> (cons (point) (treesit-node-at (point))) >> >> => (34 . #) > > The value of point is the number of the character which _follows_ > point, yes? So when the cursor is on '2', point is actually between > '(' and '2'. Right? What does this mean in terms of the node that > should be returned by tree-sitter? Correct, point is between '(' and '2'. So 34-35 means it occupies position 34-35 or [34,35). So point is outside the scope of the '(' single-char anonymous node. Or at least it should be: the problem is that it *is* inside it in this one weird instance and, near as I can find, only in this mode, and then only in this place, it isn't. I suspect `treesit-node-at' has a bug. Consider: a { background: linear-gradient(210deg, rgba(|255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); } Note the new position of point in rgba. `treesit-node-at` with `(point)` now correctly returns # Move point back one position: a { background: linear-gradient(210deg, rgba|(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); } And now: (treesit-node-at (point)) => # In start contrast to the original example. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 13:35:33 2023 Received: (at 61529) by debbugs.gnu.org; 15 Feb 2023 18:35:33 +0000 Received: from localhost ([127.0.0.1]:33971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSMcv-0006uC-1d for submit@debbugs.gnu.org; Wed, 15 Feb 2023 13:35:33 -0500 Received: from out-230.mta1.migadu.com ([95.215.58.230]:15441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSMcq-0006u1-No for 61529@debbugs.gnu.org; Wed, 15 Feb 2023 13:35:31 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1676486127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qMyIkp9Y6x8tWZcMtODXWUEKTC2FnYxsr29KujJBIZc=; b=Esxh64YkDaYEa+yzUxXlwfpxN+ysVdo2++p7mrcVFHmOerNyVD4gH0Ed4VV6zeXu6AGvT2 XBFwFNobgM/WvoWTIokHGiE9GLiCqGq81wXtBaNFbIzgs5xroMpxw/6M5cZ1J9fPA2BYMA AVx0emc4PUrQd3BMUvEqi8cD3K+wkmIx1MgYlnkVeI/n1Oym5aSqdSIdkExk+CJpJ86zUG kEi+9JUQA0W5HS14dntcsB6/5oDi4I/kQrRMkxxAF9mlpaQfO6sQ7SElqVjJmV43c6+I9s qgCtXFO5yl0oYsgIzEjbuiynfwf2/zr+1j69GDKL9/gG5TQYO9Fh6v+vcSl5Jw== From: Theodor Thornhill To: Mickey Petersen Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' In-Reply-To: <87h6vnjath.fsf@masteringemacs.org> (Mickey Petersen's message of "Wed, 15 Feb 2023 13:42:51 +0000") References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> Date: Wed, 15 Feb 2023 19:35:26 +0100 Message-ID: <87cz6a7p5d.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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 (-) Mickey Petersen writes: > Eli Zaretskii writes: > >>> From: Mickey Petersen >>> Date: Wed, 15 Feb 2023 08:25:53 +0000 >>> >>> >>> With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: >>> >>> (cons (point) (treesit-node-at (point))) >>> >>> => (34 . #) >> >> The value of point is the number of the character which _follows_ >> point, yes? So when the cursor is on '2', point is actually between >> '(' and '2'. Right? What does this mean in terms of the node that >> should be returned by tree-sitter? > > Correct, point is between '(' and '2'. So 34-35 means it occupies > position 34-35 or [34,35). So point is outside the scope of the '(' > single-char anonymous node. > > Or at least it should be: the problem is that it *is* inside it in > this one weird instance and, near as I can find, only in this mode, > and then only in this place, it isn't. I suspect `treesit-node-at' has > a bug. > Hi, Mickey! > Consider: > > a { > background: linear-gradient(210deg, rgba(|255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); > } > > Note the new position of point in rgba. `treesit-node-at` with `(point)` now correctly returns > > # > > Move point back one position: > > a { > background: linear-gradient(210deg, rgba|(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); > } > > And now: > > (treesit-node-at (point)) => # > > In start contrast to the original example. So the docstring of treesit-node-at states: "Return the leaf node at position POS. A leaf node is a node that doesn't have any child nodes. The returned node's span covers POS: the node's beginning is before or at POS, and the node's end is at or after POS. If no leaf node's span covers POS (e.g., POS is on whitespace between two leaf nodes), return the first leaf node after POS. If there is no leaf node after POS, return the first leaf node before POS. Return nil if no leaf node can be returned. If NAMED is non-nil, only look for named nodes." Doesn't this describe this behavior? Theo From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 14:12:06 2023 Received: (at 61529) by debbugs.gnu.org; 15 Feb 2023 19:12:06 +0000 Received: from localhost ([127.0.0.1]:34049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSNCI-0001pB-2K for submit@debbugs.gnu.org; Wed, 15 Feb 2023 14:12:06 -0500 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:58464 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSNCE-0001og-GN for 61529@debbugs.gnu.org; Wed, 15 Feb 2023 14:12:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OE8B0V/7msJWH/lvgcyw6cdsm8LHrKbfOxj6qB0BTXso4mfOV6F2olIyC4Aga7CT7CvAthLqkCnZZZqqfiCRSNaokEApjmhjZ57A6YFY8xoROhZdtSc4Pj0acoPJjLbR+sWcufpOv5ze0x0/MKIZZ8mv/N1sqP/0gobA7DVRoIya8SEdWXtWIFEX0xeGEaTYUr+gAaNoQnDiRWKQXV+8/Psw4KgZUI066X8vesqbErA9LWiDvHfpCw+++N+gFYRUsluJzty7b8hoXrOheXM0h+HMyoaUbQPsDIbKay0TkaY9lWKeUT/SFbOmDZPvyxZE6Y95JIndljpWl9fl9gK5kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IdtxQ0k7pIm8q/L74w1rVJkT+wCFPqzUXVrsNHrzmg0=; b=kz9Cc8YsCY/UQHdoDGTUI/rWCty+ogu5y7VaApRdvtaeGat/yR3VrBtZ7dL4h5YXNmmqOlzUvlm0a3Gnaio6oFgHHLzcQ0KvsrCM3R5rJhuNWPPogQUCSxxBCH3346KN5h836Hlyp0uTKK5PrnidxFBVv/YAt5PXuicRgpGXV4IL62hOM7hjnAxmITPINTM4WJbLH+HJz1i1PvO7lJAsuTBzFDGuS8HhKKRW20e8uQ/JPROLBwP9wwuUHx2qIt+rqQjIIEu25Mq9JG6TbVW3feScxRKT39QQS0Gi1LukrI2Lu1q2O9SPVQGAFABOqEGOQVDhdDZR6sjJjAT5obumCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IdtxQ0k7pIm8q/L74w1rVJkT+wCFPqzUXVrsNHrzmg0=; b=yvpbYj6F9X2Qla7S6saIU3FqRcWZidlVW3hbXTsbvrmtAiUwz1B+lxpjGKx2jNP8NOyx3NTfg8JeRg8mmwN+HUPbp4SM75DehldFOI9kvXZfGwsdlg5vPnNmDpIa47/MNXlNGCzohPbU70t11i0VhM35Z/H+u1EyYKU/cGn9SQQ= Received: from LO4P265CA0170.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:312::9) by LO6P265MB5968.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2a3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Wed, 15 Feb 2023 19:11:56 +0000 Received: from LO2GBR01FT041.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:312:cafe::4b) by LO4P265CA0170.outlook.office365.com (2603:10a6:600:312::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26 via Frontend Transport; Wed, 15 Feb 2023 19:11:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT041.mail.protection.outlook.com (10.152.42.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12 via Frontend Transport; Wed, 15 Feb 2023 19:11:55 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id 5984E114002; Wed, 15 Feb 2023 19:11:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1676488315; bh=tdulNLQHkpf2MN/mTUobIpMHpQhaC8KJDeYazuiQPu0=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=vsk3xmYqrA5eqwP3YzKB2XHphqxIAiRwihLIQ88rvMrpbaMRxYjtTQVlIQ1kG8Lyj 0YVqqyPnZtf95Jmn7yLd0GnYcs9ZOqnKwTLipgV42KVo8GpU1FVZbw6+HZjHtrTdlS PkAKLpHJiycgoU0QZOaorgA3UGab2UMiL9VwwTAE= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen To: Theodor Thornhill Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Wed, 15 Feb 2023 19:01:44 +0000 Organization: Mastering Emacs In-reply-to: <87cz6a7p5d.fsf@thornhill.no> Message-ID: <87cz6akakn.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT041:EE_|LO6P265MB5968:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e3298ccc-c1b1-476a-9fc2-08db0f8880fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R6pGEGSADAL5wu+C8BONJ37NIoNzazWknH55gKYxRLa8t3khIjIAGnYq+8s3aoUsp4rtHzni+F1TVGKJpoFIYES0e9SxbkhPcbO9O12igzvyTz3/eAFq0yCCs22kPCVaH2FQ5RLSHJqiG1g4KCQH21kwv8+w9inYce8Ozux7PXI/OCeu2p6LKkvTe0tEbA8vMlO8Uq4n/iqnbBgslLNcDrGRPnbTR6JMNjH57BiZyKiGhVE918Lxj5u4/zvJDYvQNpCkFOVFdSYnZ1XETBbbeRDZI1yE7I2PtKXZrCn/Cjpxk4Mzd5cZFMCAvlCJRAGsg6Y/K8cMVVvyePc56FgBZhhCJHDhCZ4kwyX2+XJwkN/nsb/w9P+rTd5uKy/+pT7fKGNI/nhcKFacWgKV9TcpajvKiE24BlybSJM1ypiBJpOV6ndOi7RjFDScxga5ZwInZ32fkgmcfVkHp9AehjAcDyb2h96Pw5I5ziK7VeqfmsmoS43HdgHO6R2CQkLoLpZTIJHRVDTkQZKF7xHFODGFzuSBZjLDqge9gOFVA29gfFudUuin5chIPlZtyN2KKfTKZYh8mBRkCHoMtlV2fiXZCbXEOfyKoZ1x/SHrP9gLAG/RuzCZS5X35ANh+JPp7j62Fn8srDQNd3he7XLP9lRnpLbAv8r/ZChIPXWBkOZiaPMy9peT+mY0swAq1M+Yb0nmnXz8/pI1/M7iwWN+ULjmTfaCUSw3TdMNRbKg676V+jDTtCNZxdBretBuM6ydQEh0gZL35FhHEp2kVGSUOp1jsQ== X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(376002)(396003)(136003)(39830400003)(346002)(451199018)(36840700001)(46966006)(83380400001)(478600001)(2616005)(336012)(47076005)(36916002)(6666004)(36756003)(26005)(6266002)(186003)(356005)(41300700001)(5660300002)(6862004)(86362001)(8936002)(42186006)(40480700001)(316002)(8676002)(4326008)(82310400005)(70206006)(2906002)(7596003)(7636003)(70586007)(36860700001)(38230200001)(81973001)(79816003)(14776008); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2023 19:11:55.6531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3298ccc-c1b1-476a-9fc2-08db0f8880fb X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT041.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO6P265MB5968 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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 (-) Theodor Thornhill writes: > Mickey Petersen writes: > >> Eli Zaretskii writes: >> >>>> From: Mickey Petersen >>>> Date: Wed, 15 Feb 2023 08:25:53 +0000 >>>> >>>> >>>> With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: >>>> >>>> (cons (point) (treesit-node-at (point))) >>>> >>>> => (34 . #) >>> >>> The value of point is the number of the character which _follows_ >>> point, yes? So when the cursor is on '2', point is actually between >>> '(' and '2'. Right? What does this mean in terms of the node that >>> should be returned by tree-sitter? >> >> Correct, point is between '(' and '2'. So 34-35 means it occupies >> position 34-35 or [34,35). So point is outside the scope of the '(' >> single-char anonymous node. >> >> Or at least it should be: the problem is that it *is* inside it in >> this one weird instance and, near as I can find, only in this mode, >> and then only in this place, it isn't. I suspect `treesit-node-at' has >> a bug. >> > > Hi, Mickey! > Hey Theo! >> Consider: >> >> a { >> background: linear-gradient(210deg, rgba(|255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >> } >> >> Note the new position of point in rgba. `treesit-node-at` with `(point)` now correctly returns >> >> # >> >> Move point back one position: >> >> a { >> background: linear-gradient(210deg, rgba|(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >> } >> >> And now: >> >> (treesit-node-at (point)) => # >> >> In start contrast to the original example. > > So the docstring of treesit-node-at states: > > > "Return the leaf node at position POS. > > A leaf node is a node that doesn't have any child nodes. > > The returned node's span covers POS: the node's beginning is before > or at POS, and the node's end is at or after POS. > > If no leaf node's span covers POS (e.g., POS is on whitespace > between two leaf nodes), return the first leaf node after POS. > > If there is no leaf node after POS, return the first leaf node > before POS. > > Return nil if no leaf node can be returned. If NAMED is non-nil, > only look for named nodes." > > Doesn't this describe this behavior? > It's a good question: I suppose it's a question of wording (or understanding) more than it necessarily being *wrong* -- it is, after all, a custom function. I read and interpreted it to mean that due to how node boundaries work that "*end is at* or after POS" to mean that point is wholly contained in the node "(" which, due to how tree-sitter determines node extents, it technically isn't. But I think it's fair enough if this is intentional -- I've no real suggestions for improving its behaviour if this is intended. So if it's working as expected, then it's safe to close the issue. Thanks. Mickey. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 15 14:42:50 2023 Received: (at 61529) by debbugs.gnu.org; 15 Feb 2023 19:42:50 +0000 Received: from localhost ([127.0.0.1]:34084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSNg1-0002af-Ur for submit@debbugs.gnu.org; Wed, 15 Feb 2023 14:42:50 -0500 Received: from out-131.mta0.migadu.com ([91.218.175.131]:10611) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSNg0-0002aU-2F for 61529@debbugs.gnu.org; Wed, 15 Feb 2023 14:42:49 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1676490166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6tWLv51RTfQSri3+r69YN4kvsbFAlmvwIr3tqXjzrBc=; b=OqjDLxngwAf1Spgy+h6EqNPS0VWXGEkJ9TwPkDK4Yed6iZNnlcmNfMnpjYI7YKB3nRcjsT gG2uMXI8cj46OO4y6TDmgjMh2uCyeJlaS1n5v+1rT76KUfZt3Kh3UaS5MFwew4DwLD9mT1 q+mGvdaWH8+P/vlZY6iY7NqByjD+1OVeW21EXzIaaIMlX8g7drCN1tT+Lek48nn505k2sE HjHaZI83YnqkKtMnQGJl4/4E37Ekr/3Iewbl9lNfLHybDDz/HIWk5/N7zAszKtvt+P4Sra CaxF4v43DfzF00hUN4ge8Q0TEp393RRKDgYaM+x48HQea1bNQWRZt0V54ILhGw== From: Theodor Thornhill To: Mickey Petersen Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' In-Reply-To: <87cz6akakn.fsf@masteringemacs.org> References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <87cz6akakn.fsf@masteringemacs.org> Date: Wed, 15 Feb 2023 20:42:45 +0100 Message-ID: <874jrm7m16.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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 (-) Mickey Petersen writes: > Theodor Thornhill writes: > >> Mickey Petersen writes: >> >>> Eli Zaretskii writes: >>> >>>>> From: Mickey Petersen >>>>> Date: Wed, 15 Feb 2023 08:25:53 +0000 >>>>> >>>>> >>>>> With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: >>>>> >>>>> (cons (point) (treesit-node-at (point))) >>>>> >>>>> => (34 . #) >>>> >>>> The value of point is the number of the character which _follows_ >>>> point, yes? So when the cursor is on '2', point is actually between >>>> '(' and '2'. Right? What does this mean in terms of the node that >>>> should be returned by tree-sitter? >>> >>> Correct, point is between '(' and '2'. So 34-35 means it occupies >>> position 34-35 or [34,35). So point is outside the scope of the '(' >>> single-char anonymous node. >>> >>> Or at least it should be: the problem is that it *is* inside it in >>> this one weird instance and, near as I can find, only in this mode, >>> and then only in this place, it isn't. I suspect `treesit-node-at' has >>> a bug. >>> >> >> Hi, Mickey! >> > Hey Theo! > >>> Consider: >>> >>> a { >>> background: linear-gradient(210deg, rgba(|255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >>> } >>> >>> Note the new position of point in rgba. `treesit-node-at` with `(point)` now correctly returns >>> >>> # >>> >>> Move point back one position: >>> >>> a { >>> background: linear-gradient(210deg, rgba|(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >>> } >>> >>> And now: >>> >>> (treesit-node-at (point)) => # >>> >>> In start contrast to the original example. >> >> So the docstring of treesit-node-at states: >> >> >> "Return the leaf node at position POS. >> >> A leaf node is a node that doesn't have any child nodes. >> >> The returned node's span covers POS: the node's beginning is before >> or at POS, and the node's end is at or after POS. >> >> If no leaf node's span covers POS (e.g., POS is on whitespace >> between two leaf nodes), return the first leaf node after POS. >> >> If there is no leaf node after POS, return the first leaf node >> before POS. >> >> Return nil if no leaf node can be returned. If NAMED is non-nil, >> only look for named nodes." >> >> Doesn't this describe this behavior? >> > > It's a good question: I suppose it's a question of wording (or > understanding) more than it necessarily being *wrong* -- it is, after > all, a custom function. > > I read and interpreted it to mean that due to how node boundaries work > that "*end is at* or after POS" to mean that point is wholly contained > in the node "(" which, due to how tree-sitter determines node extents, > it technically isn't. > > But I think it's fair enough if this is intentional -- I've no real > suggestions for improving its behaviour if this is intended. So if > it's working as expected, then it's safe to close the issue. > There is one thing here which confuses me a lot and that you might also have some thoughts on. Consider some simple tsx: ``` const x = () => (
try to C-SPC C-SPC at the beginning of try after activating treesit-explore-mode
) ``` Now you can maybe see that the jsx_text node covers a lot more than just the line in the middle. There are some other cases like this in some languages, and they do trip up our semantics. May this be one similar such case, just not concerning indentation in this case? IOW, sometimes the parser also returns nodes including whitespace, so it looks like we are outside a node, but we're not yet. Theo From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 16 14:53:25 2023 Received: (at 61529) by debbugs.gnu.org; 16 Feb 2023 19:53:25 +0000 Received: from localhost ([127.0.0.1]:37712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSkJo-0005cL-SE for submit@debbugs.gnu.org; Thu, 16 Feb 2023 14:53:25 -0500 Received: from mail-lo2gbr01on2123.outbound.protection.outlook.com ([40.107.10.123]:28409 helo=GBR01-LO2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSkJm-0005c2-BS for 61529@debbugs.gnu.org; Thu, 16 Feb 2023 14:53:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XmzHY6fH+E0TRt2xrJqyt2jMigM2IPVp4WrwSIaWxsnjG6pVV4Q9i+iA0YlXnz2rYG2e2U33PWRpIzwwitNOYuq9voJd08zOy19bU0gslf1zHjx96h4NxnT7bXsm7soSJ5+WQs+Ja0r1wRFxvG0BOjXstZYb2zWih48uhZO1efnp+tPjTda7zanxDM08BDgG4mcdbz4LDuY1bp0tzuy3nxFo3k1kRd89gZrCadG24+XfCYNfzBj7Do7DM2k94IDQBhNkRcGS7OXHFkuU+PF7KeD0YhAEIC8xaNY87Uo54zFSgTPJTrcPk9ulLGq5LeGcJMyJ66ZQnEVbUI1Qi3ADLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=77QXugNXTRHtJHsJHnaeMjAHSH+xuZ4KFqKiPVpd9o0=; b=nfO0gb/HZM7jY9Kn2RNsDNK3SRHWpISnwzXks1QQnuYjPD5cu1MqPbadRdEfjiY/N/EzMhy7ekuPnyHY+rev1p24hLkp3C8AEmliJqACkJpsdkroglDXrt6UHC6z1Nz792V+m1bffB0wxHW3vIBrjUalHBTgN7ca5IeSQ0rySWpXh0/wTAgGcyqTE6wsQYj2LjjXK/OhwLNpGRWfbdpk6PyLU9T1ZCA1LyTHOU7U2mKWf3Qq4IK7tzMp6JMzPRLOA91plboylKP7Y/LScIyB9LHiweCv5OSgWqHDTJWyIgAg8bimoU8G+AIC007x30gKW3VpUHoq9MwPy+WwbhKSKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=77QXugNXTRHtJHsJHnaeMjAHSH+xuZ4KFqKiPVpd9o0=; b=O8OAe9fjcVLfmj0O3ctwYK4KlZ/mKtBl4z8d4C9R6HdyBM3GhFqTgrT2YU5Xm/M6LSDqWhHfIrCUhhWZPEGJl0GEpQgIHFGsWF0D3A/ZoATDFy2kPb9OFU0hpQAn5J95wgaI6YAdldN1MsYgW/5jP3kgS8ylw0fj50O8X/xXmPA= Received: from LO2P265CA0512.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13b::19) by LO0P265MB5668.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:261::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12; Thu, 16 Feb 2023 19:53:13 +0000 Received: from LO2GBR01FT023.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:13b:cafe::a7) by LO2P265CA0512.outlook.office365.com (2603:10a6:600:13b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.12 via Frontend Transport; Thu, 16 Feb 2023 19:53:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT023.mail.protection.outlook.com (10.152.42.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13 via Frontend Transport; Thu, 16 Feb 2023 19:53:13 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id A715A114003; Thu, 16 Feb 2023 19:53:12 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1676577192; bh=h5U10eDwYENIZx9OXxr4vFMaumVQVqeX0ZE9Wpxs5KU=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=Ey97Su+TSFcobrQyXtBLLimdut71U4GKTawuIm+UXWKyVVIgCt6/g6g/sZbm8YqBW DUx2JVixLO10r1AtG/EmQsyA+ECqTXkr9+3+YmWz7CN9oUQoL8f7pAwengcL4SKr8L XSQo42sju5wmdHqqpoU7j0hkLSHU1N8lqbtbN58s= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <87cz6akakn.fsf@masteringemacs.org> <874jrm7m16.fsf@thornhill.no> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen To: Theodor Thornhill Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Thu, 16 Feb 2023 19:48:06 +0000 Organization: Mastering Emacs In-reply-to: <874jrm7m16.fsf@thornhill.no> Message-ID: <87zg9didzt.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT023:EE_|LO0P265MB5668:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: afaa692f-0175-43d7-baf6-08db10577007 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfW2IJuHzPJhegQm2LQkqAFTgaMX89Tgo+kMmAVXxLDzOabqRpJdIeS5hIVH8GK96/MgKX83vxjE5kI435doDeRAd0foNk2zCHCbJrzG5icLPZ1L4kBnW9G/LSSc6Anekhw3VZO7mNlxSwsEzLuqjHLceklMycINxoTZwan+BudjgKpb3j9W7CDSTXO9A7GBZpLaEJFquV98potYHTDZbu1dOFr3xv3MA6dT4PEHz3+TzPFKFhur7159OFa7MHKOnvx4cmIbktJCLJawvDVhcNqLoBunvQN4+HeiDOEEI5oOK1HEJfbLGlr1he+mG5OmfbnTxkggJm4VOKQS9/qwxRZnm3y8YSdUdovorl4hhH1WovRtCeUQLsDVzIi2jpRTA4zU6fEXxeYnbEtGCWvdzjeGUKoOFAoH4wXPBae/t56gm1WRDKLtjO0a9TVXhNf8FZzf0dLKTCkiUH8C+9ei8L6W754at3y9vZqe+ZOf/5bTPc0OGPScARTAVvWellO4wFe1jx3yGreI3gHGHhZGvv5zYuEuH4ETAYd4o8A8pJVxtZrGmUb7nES18kUCCY1qzEsd/mqlthvao3eTeoQlvXaJacq7X+W87H0/D8A4hPkBKehnMRbr/PWt19p35crP2HabrlZMz82cLKYI/XZ0ISA8EpBitd1h3fG3fs/WQamzutjYMppQfWbAKDHAxnte8Pz8xfmjEihTFQTSVe4btg/BFVefAeiFObIcQk0YdhBhp3IfqkvyhVMvOKs3KZ5DxuGks2cAa3vbfrgVJ03o2Q== X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(136003)(39830400003)(376002)(346002)(396003)(451199018)(36840700001)(46966006)(5660300002)(6862004)(41300700001)(2906002)(4326008)(70586007)(70206006)(8676002)(316002)(42186006)(47076005)(36916002)(36860700001)(478600001)(36756003)(186003)(336012)(26005)(6266002)(6666004)(8936002)(2616005)(86362001)(7596003)(40480700001)(7636003)(82310400005)(83380400001)(356005)(38230200001)(81973001)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 19:53:13.0342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afaa692f-0175-43d7-baf6-08db10577007 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT023.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB5668 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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 (-) Theodor Thornhill writes: > Mickey Petersen writes: > >> Theodor Thornhill writes: >> >>> Mickey Petersen writes: >>> >>>> Eli Zaretskii writes: >>>> >>>>>> From: Mickey Petersen >>>>>> Date: Wed, 15 Feb 2023 08:25:53 +0000 >>>>>> >>>>>> >>>>>> With point at '2', then I'd expect `treesit-node-at' to yield that node. But it does not: >>>>>> >>>>>> (cons (point) (treesit-node-at (point))) >>>>>> >>>>>> => (34 . #) >>>>> >>>>> The value of point is the number of the character which _follows_ >>>>> point, yes? So when the cursor is on '2', point is actually between >>>>> '(' and '2'. Right? What does this mean in terms of the node that >>>>> should be returned by tree-sitter? >>>> >>>> Correct, point is between '(' and '2'. So 34-35 means it occupies >>>> position 34-35 or [34,35). So point is outside the scope of the '(' >>>> single-char anonymous node. >>>> >>>> Or at least it should be: the problem is that it *is* inside it in >>>> this one weird instance and, near as I can find, only in this mode, >>>> and then only in this place, it isn't. I suspect `treesit-node-at' has >>>> a bug. >>>> >>> >>> Hi, Mickey! >>> >> Hey Theo! >> >>>> Consider: >>>> >>>> a { >>>> background: linear-gradient(210deg, rgba(|255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >>>> } >>>> >>>> Note the new position of point in rgba. `treesit-node-at` with `(point)` now correctly returns >>>> >>>> # >>>> >>>> Move point back one position: >>>> >>>> a { >>>> background: linear-gradient(210deg, rgba|(255,82,41,1) 0%, rgba(251,165,85,1) 54%, rgba(163,73,73,1) 100%); >>>> } >>>> >>>> And now: >>>> >>>> (treesit-node-at (point)) => # >>>> >>>> In start contrast to the original example. >>> >>> So the docstring of treesit-node-at states: >>> >>> >>> "Return the leaf node at position POS. >>> >>> A leaf node is a node that doesn't have any child nodes. >>> >>> The returned node's span covers POS: the node's beginning is before >>> or at POS, and the node's end is at or after POS. >>> >>> If no leaf node's span covers POS (e.g., POS is on whitespace >>> between two leaf nodes), return the first leaf node after POS. >>> >>> If there is no leaf node after POS, return the first leaf node >>> before POS. >>> >>> Return nil if no leaf node can be returned. If NAMED is non-nil, >>> only look for named nodes." >>> >>> Doesn't this describe this behavior? >>> >> >> It's a good question: I suppose it's a question of wording (or >> understanding) more than it necessarily being *wrong* -- it is, after >> all, a custom function. >> >> I read and interpreted it to mean that due to how node boundaries work >> that "*end is at* or after POS" to mean that point is wholly contained >> in the node "(" which, due to how tree-sitter determines node extents, >> it technically isn't. >> >> But I think it's fair enough if this is intentional -- I've no real >> suggestions for improving its behaviour if this is intended. So if >> it's working as expected, then it's safe to close the issue. >> > > There is one thing here which confuses me a lot and that you might also > have some thoughts on. Consider some simple tsx: > > ``` > const x = () => ( >
> try to C-SPC C-SPC at the beginning of try after activating treesit-explore-mode >
> ) > ``` > > Now you can maybe see that the jsx_text node covers a lot more than just > the line in the middle. There are some other cases like this in some > languages, and they do trip up our semantics. May this be one similar > such case, just not concerning indentation in this case? > Yeah that's just how XML is, which is more or less what JSX is based on. So that does not seem too surprising to me in this particular case that the jsx_text node has extra whitespace around the text, even if it is insignificant in SGML. (Though some xml parsers do trim the leading and trailing element whitespace...) > IOW, sometimes the parser also returns nodes including whitespace, so it > looks like we are outside a node, but we're not yet. > > Theo From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 16 16:26:16 2023 Received: (at 61529) by debbugs.gnu.org; 16 Feb 2023 21:26:16 +0000 Received: from localhost ([127.0.0.1]:37798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSllg-0008M8-7x for submit@debbugs.gnu.org; Thu, 16 Feb 2023 16:26:16 -0500 Received: from mail-ed1-f52.google.com ([209.85.208.52]:37868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSlle-0008Lu-WC for 61529@debbugs.gnu.org; Thu, 16 Feb 2023 16:26:15 -0500 Received: by mail-ed1-f52.google.com with SMTP id c1so8014580edt.4 for <61529@debbugs.gnu.org>; Thu, 16 Feb 2023 13:26:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=lk95+IFkg2oVIny+WMlqDjslBaqbnot20JHviBkZutg=; b=Emsk9N6LyxatAWhdVWLco06fuVlLM0YosdgMYQSrVPH/eTrDEVsI0mQfLqdWr0tcVI t1v1+2tvo/bnSovAOa2P09B2tcEskp4/Cq3SsK5bKCk06yPxO77mYBtcW5KuWa11j8v3 5E3ovZxmPsttCee6sPmV6OJYAJ/uxD7SN31nA7TtwSm1e5yqOtHunMIAx+dhunljscWN BHTa7CsYzx9uuxFE8frCJXgZmf0IY9ZTFyY1drtU0858jh54KSe5/C4Z+CnhDGRJw6rq 6gMGXpvkkj32l85V2P4o1ehkzGfpQ47tcjrWBf24ibwXCln0qOAc3TYLfemCwVgGYel6 aUJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lk95+IFkg2oVIny+WMlqDjslBaqbnot20JHviBkZutg=; b=tP9FIiCbf2ScOHNmfI3ArQY/P7qX8KJpWD+tVztzydXsR69uh+Ab8CqQsayJgcSbHr ASdCpoIGi2iaZMYa/uY9HnCWdrgf5dImItTA6XExXuaza8BwFT5ZyvR4XOcAANWIP9IX 0CPBJBwJuqrKswS1DYCIiEKaJyPu3JANKyCR53ix+/wiRMkpxkE7/u1xEOmLj+Fq/lrc HMocbo+S71jZXuANso5fVWdRkKfjr/aZdQ8sxjg7iNhnohB18Ww4Jd1eDRVVvPS4fy08 PTTiJmyGDLYcmdn6AGnOLdtD2mTqe46+NXMxBDRcDU7T0ntGK9wr/EcMF6LeGa+ZNo/l OcCg== X-Gm-Message-State: AO0yUKUCbXF8VWS7/Yp1GW/78eY5plh0ArZOtf+ZhiCjC5ZaA5JOQ45t rCYcns3qFrBMRhyI/Rymxpo= X-Google-Smtp-Source: AK7set9T5YzKhE/GfEWJevGx+FaqGDUIKbaMfvbDgh3Bo4Dyk7j1Ct8RW3rSaRgGNn3jSan9XUtVBw== X-Received: by 2002:a17:906:1313:b0:8aa:bf4e:7b2c with SMTP id w19-20020a170906131300b008aabf4e7b2cmr7777483ejb.21.1676582768460; Thu, 16 Feb 2023 13:26:08 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id fy5-20020a170906b7c500b008b112db78f9sm1257724ejb.51.2023.02.16.13.26.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 13:26:07 -0800 (PST) Message-ID: <2263f8ab-5d76-9a2c-b34d-4532c9ad5645@yandex.ru> Date: Thu, 16 Feb 2023 23:26:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Content-Language: en-US To: Mickey Petersen , Theodor Thornhill References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <87cz6akakn.fsf@masteringemacs.org> From: Dmitry Gutov In-Reply-To: <87cz6akakn.fsf@masteringemacs.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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.9 (-) On 15/02/2023 21:01, Mickey Petersen wrote: > I read and interpreted it to mean that due to how node boundaries work > that "*end is at* or after POS" to mean that point is wholly contained > in the node "(" which, due to how tree-sitter determines node extents, > it technically isn't. > > But I think it's fair enough if this is intentional -- I've no real > suggestions for improving its behaviour if this is intended. So if > it's working as expected, then it's safe to close the issue. The difference in this case is due to the tree structure: In '210deg', (integer_value) is not a leaf node. The only leaf node it has inside is (unit), and that one starts 3 characters later. In '255', however, (integer_value) *is* a leaf node. And since treesit-node-at looks for leaf nodes, it stops at "(" as documented. I'd probably calls it a problem with the grammar, but it doesn't seem likely to be fixed, backward compatibility and all. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 16 16:35:08 2023 Received: (at 61529) by debbugs.gnu.org; 16 Feb 2023 21:35:09 +0000 Received: from localhost ([127.0.0.1]:37825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSluG-0000B3-KN for submit@debbugs.gnu.org; Thu, 16 Feb 2023 16:35:08 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:34418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSluF-0000Ap-A8 for 61529@debbugs.gnu.org; Thu, 16 Feb 2023 16:35:07 -0500 Received: by mail-wr1-f43.google.com with SMTP id d4so3053182wrj.1 for <61529@debbugs.gnu.org>; Thu, 16 Feb 2023 13:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=1YJfJy7cIwK4OGDpxw2SoyGNXldth3T7vkfVJV1sNI8=; b=peuJTzijmSDYRxC8L64z3hM+z1ofJyDD45fCQ4RqK9SbqgVNioAbm/H1To0HLH2yeZ CIpUybVIJxZmcUTmWCsOnnkXUa03+UTIlnfAfBiVCkWgkbwV4kkdyR1JQbRRbT+EERJC w5ydk6dxz0d+BFH2pz2cypddw16bUdTdRGptaWEiadaHV3JKtKdMPS1UltIGHBTfhhHB n7WVIXIwoMIKV/2XZEGf1hTuvtnn3/snzdBqRjD5GgJi1qYVPDuoqpYU5NKJYqAAM80Y /+EE5MPzckThSJKhmE75XSVFUbeEUMmy5d2keXOckchG/J5UYa0RIH3AtlYIa0armenO LtBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1YJfJy7cIwK4OGDpxw2SoyGNXldth3T7vkfVJV1sNI8=; b=e/6OxTMvoCcs56rWyGARP5JawTPXlwJOe0Del3gzbVgE8O5zuNrXv67BU9mwdX74LW wmXu/wawbX5gIohWfsha8wevZmWVTq1CcGfwWF4HwadRYvulLQafM00X1YVHzIWrmcs4 tW79O/b1K77U4K2UXLM/c83PqepOtR7NpeTe0sbJVawY0UI1MTBtEZiw2xz3f7d8gKXk TMthsGVLJLFa1537wyvSYZp3oBrNKjzwQ+aWmOiUuqF/qqfLPWM8evqnDkzvta8MedUX Sl2kY1gCNbp+HJGmL4MLxxHJpWddgU9tHyrYLJg7M8zaDD+CLhSS77cHngVpF+V3lw8u KlRw== X-Gm-Message-State: AO0yUKVkBQDQYN7GqAW++zDPMDmFxn9Jgf3vjKUOQTX8fpOg861wOOXR YmtB/uOAkEzDvFZTjin46HI= X-Google-Smtp-Source: AK7set9uZypZxFV7Riaa8TPoRY07P4PAuhG+IOLhtet08XtnuYFSxA7R7s0Ruhqw8vTqrLYvCJD/IQ== X-Received: by 2002:a05:6000:120e:b0:2c5:63df:1171 with SMTP id e14-20020a056000120e00b002c563df1171mr6740839wrx.19.1676583301411; Thu, 16 Feb 2023 13:35:01 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id j2-20020adfea42000000b002c573cff730sm2590778wrn.68.2023.02.16.13.35.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 13:35:01 -0800 (PST) Message-ID: <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> Date: Thu, 16 Feb 2023 23:34:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Content-Language: en-US To: Theodor Thornhill , Mickey Petersen References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> From: Dmitry Gutov In-Reply-To: <87cz6a7p5d.fsf@thornhill.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61529 Cc: Eli Zaretskii , 61529@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.9 (-) On 15/02/2023 20:35, Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > So the docstring of treesit-node-at states: Looking at the code, this change might describe it better: diff --git a/lisp/treesit.el b/lisp/treesit.el index 749781894b8..6e53b3d4c4a 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -166,10 +166,13 @@ treesit-node-at A leaf node is a node that doesn't have any child nodes. The returned node's span covers POS: the node's beginning is before -or at POS, and the node's end is at or after POS. +or at POS, and the node's end is after POS. -If no leaf node's span covers POS (e.g., POS is on whitespace -between two leaf nodes), return the first leaf node after POS. +If no such node is found, but a leaf node ends at POS, it's +returned. + +Otherwise (e.g., when POS is on whitespace between two leaf +nodes), return the first leaf node after POS. If there is no leaf node after POS, return the first leaf node before POS. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 01:16:45 2023 Received: (at 61529) by debbugs.gnu.org; 17 Feb 2023 06:16:45 +0000 Received: from localhost ([127.0.0.1]:38276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSu32-0000lR-SO for submit@debbugs.gnu.org; Fri, 17 Feb 2023 01:16:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSu30-0000lD-28 for 61529@debbugs.gnu.org; Fri, 17 Feb 2023 01:16:43 -0500 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 1pSu2t-0006gG-Mb; Fri, 17 Feb 2023 01:16:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zRJDVCEoi9mYp5eWGzX3fYkKwsx4Gduu9LHlM/lPxmU=; b=n+xSbR+DEBAz nPyJykKIIXqhlYlHOqQ/oDMXW7sIpcVWb0dl9balW9VWh0TOdbbxl4Jth7hmaGlhZTaxiSU0lpFhr idYJ/dOCgMz22ZNROwqcq6ApKBIPltrZPpFJZSzKFdJqfyrCTQhDcR39QFwsYSjBhHZ3d+9DfuOjt erxH/oeb98kqdeZGMFR3lP23pIkjh3ORPhm8pWyIWlanFTn1x7gno8jt0UOqJEWzI7gXsmzs9up1K fvRU9PzhpNeVm9cNfUv2FRNG7P6CjDpkiTGeX/S4vAHxitsRD5qk+rzzxjjcHdH3TfynOLBUwISLo yUjJSXKc4HxUOlnMOSisdA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pSu2t-0007Ov-65; Fri, 17 Feb 2023 01:16:35 -0500 Date: Fri, 17 Feb 2023 08:16:33 +0200 Message-Id: <8335743jge.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> (message from Dmitry Gutov on Thu, 16 Feb 2023 23:34:58 +0200) Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61529 Cc: mickey@masteringemacs.org, 61529@debbugs.gnu.org, theo@thornhill.no 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 (---) > Date: Thu, 16 Feb 2023 23:34:58 +0200 > Cc: Eli Zaretskii , 61529@debbugs.gnu.org > From: Dmitry Gutov > > +If no such node is found, but a leaf node ends at POS, it's > +returned. Passive tense alert! This is better: If no such node exists, but there's a leaf node which ends at POS, return that node. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 02:25:46 2023 Received: (at 61529) by debbugs.gnu.org; 17 Feb 2023 07:25:46 +0000 Received: from localhost ([127.0.0.1]:38337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSv7p-0002l3-Lk for submit@debbugs.gnu.org; Fri, 17 Feb 2023 02:25:46 -0500 Received: from mail-lo2gbr01on2137.outbound.protection.outlook.com ([40.107.10.137]:59755 helo=GBR01-LO2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSv7n-0002kp-9l for 61529@debbugs.gnu.org; Fri, 17 Feb 2023 02:25:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ky04daAX8d1oNEEfjkCG7y5McNmEjP/Ql8qUJlMxF56zdQzEC99fdYC9xMS5syl8s2QsCiklraT2sBAS7mPRPAIgYOuhy8m4JWfgsncKIZP4JtzYenmQfs332tDHtG+n1prWVEXHC1pJ6IPMWa2HYDZEKdXchlbkI8Edx/9FVvxJNoX+du5ufrfnneBfSxDYySvwAgCSGMYINIB3F0966C4OEXr35okXnsmhyqRXC2X/IY25WRtSGauTbIpd0b0AveBUCqun22wDXbHyWZS4lMh/9mxwB9VgTCUEpp2VSwtzOKzKIeuij1xyL7jGMtcW27RXYKUAvpAl1Ut838rdAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZS11gx3EUON29X0Gh6vmCXpjvfu8VHSbegVXTjd0wZY=; b=krLBWfYpNhYO5TLU4sIIK4KSqtNwTzqv1FfagsWgLlIorVCcrD13WuGVXfY1ouNw7ACZmikZB25TOXkgvowWsslqj6KnGSIdCvwT4Kg2nVdiNnRJDbO2du4MsyulA0FsKlbSWGsL06cElRUZIDjI4tq+vp7HdxuyKmkgcBBIJDavd33KqoEr+Mmot3HKbAa3kLGAhpj4qN8V0+c9857vuUlmuUqgKvwv3kW+pbgHWwpjZREG1LcXvLYfm5bP+8GQAVnDtO7EtLzvlbwp+5REWraZKxlXpR9McYdReBDPhcckouhwAIQ9snDsrOG0zEd9XChnIPkfx+wLfUlZxGvg7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 178.79.136.144) smtp.rcpttodomain=debbugs.gnu.org smtp.mailfrom=masteringemacs.org; dmarc=pass (p=none sp=none pct=100) action=none header.from=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semantical.onmicrosoft.com; s=selector1-semantical-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZS11gx3EUON29X0Gh6vmCXpjvfu8VHSbegVXTjd0wZY=; b=GLAFhSfxYn2+avzCC38lIU0InC3VkWdZMGjLnVi6HJZPP9cXJF7w5x5EkDV+Zh8pz+fb3KRCBKgBag5XhylGGv1FGRyjdYDN8SYbWtsT3lbNVZznZtmqoB6YIddegIOA3Up7lqJauWiqld2pqhKQKx5z7/5U6BELvuN8n8WcRno= Received: from LO2P265CA0040.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::28) by CWLP265MB5907.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1cc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13; Fri, 17 Feb 2023 07:25:33 +0000 Received: from LO2GBR01FT015.eop-gbr01.prod.protection.outlook.com (2603:10a6:600:61:cafe::66) by LO2P265CA0040.outlook.office365.com (2603:10a6:600:61::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13 via Frontend Transport; Fri, 17 Feb 2023 07:25:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 178.79.136.144) smtp.mailfrom=masteringemacs.org; dkim=pass (signature was verified) header.d=masteringemacs.org;dmarc=pass action=none header.from=masteringemacs.org; Received-SPF: Pass (protection.outlook.com: domain of masteringemacs.org designates 178.79.136.144 as permitted sender) receiver=protection.outlook.com; client-ip=178.79.136.144; helo=semantical.co.uk; pr=C Received: from semantical.co.uk (178.79.136.144) by LO2GBR01FT015.mail.protection.outlook.com (10.152.42.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13 via Frontend Transport; Fri, 17 Feb 2023 07:25:33 +0000 Received: by semantical.co.uk (Postfix, from userid 5001) id AD3B6114003; Fri, 17 Feb 2023 07:25:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=masteringemacs.org; s=masteringemacs.org; t=1676618732; bh=VuFg4dKemq+CAM7dP6nBtLrpRZAyZJv7cNWcuz07lQ8=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=PwzL3r41IyfRy/5DDd+NAsTWWpynDaTn+sjEthxywjd3HHa0899OlrhBPQ19HbedN yOSWWL4pr+sM0YXNa0E1XYi1etfXFEu5/1mD2gb94UvrSWIz7cCPUS9Z9a2ASFwjO8 F7McCBVWEqnFkTvH5j/Z6MR5j3gfI/4EYvI9r3iQ= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on semantical.co.uk X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> <8335743jge.fsf@gnu.org> User-agent: mu4e @VERSION@; emacs 30.0.50 From: Mickey Petersen To: Eli Zaretskii Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Date: Fri, 17 Feb 2023 07:24:42 +0000 Organization: Mastering Emacs In-reply-to: <8335743jge.fsf@gnu.org> Message-ID: <87v8k0iwie.fsf@masteringemacs.org> Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2GBR01FT015:EE_|CWLP265MB5907:EE_ MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f4368dec-8a6e-4581-490c-08db10b827d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wwcprm2nQzGqyKArUroQX5TX74SvE6nuwzzBh474m6vNfojyoidZcjHs5+McBD15fLyWy2Ms2ba5fkHxxCr6yLItzSPbmLJbSzs3ZF4/Rl6l/xWa1aymSGpBB9U4I8gEoVyHj4aiSdIowM0o0d6OIgMLrII5fqn4GhUuPyciXzAvfjaL9X/yA7bVvsGYYRQpxeHuWtl5CnbD81tJBc88t9QptlcFdy7CSND+dRugIDSQDY2XrTojqGohQG4E16GJqR6tvGfVBYKyFB4rNpxSqCV89Jef7Yv6YDq78Ugkajr7D9XEUoaCdbxOw1G523Y+HnXc+dbUpJ4ARABhMVFG9g0yfwN/vceOId5u7kn09u38vlNw7Ocde9/i62AAoJFWo4f/CE3dhbLCETo/8hR/mBET4jBcoStylpx0nJthzOCBR6lA0Ygcld7Dphnnk04Yb0wgo/FF0cWoWR7j0/9fNYqVJHM0R5FyE2Ab6VzZoQRuR1bowYO6xkswaTnd9e36w0uKhzXG8YS8P7XARN8bXHCgvvvmR5WxuKuHGrV4YnboxyWBBpgsb6VmZbahg2tiUrli9ybF6I4rgmPbHeX72INX4iCHmN5VjQoODTdRPZv+THRAwlNXsTpRI0kQbq8Mxa12MZpru2GqDGxUq+rGQ0PepkbuIYY7X7QeTRxHOUqUf7wPvSMRBbbCKtM0FgnXkKlZdUKPPEqrwOmer1zil6Rt4pqI9+CKjh4JrTa0QUOW0WB1OAWUTBHESSAJhqkzSIgrJo/W7l6Cymc2d9lp5fuyI0rYU93KTT6zuH9P3/9NForp9xhzq7NUjoocUTFC X-Forefront-Antispam-Report: CIP:178.79.136.144; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:semantical.co.uk; PTR:semantical.co.uk; CAT:NONE; SFS:(13230025)(396003)(136003)(376002)(39830400003)(346002)(451199018)(36840700001)(46966006)(36756003)(40480700001)(2906002)(6862004)(5660300002)(8936002)(70206006)(70586007)(316002)(36916002)(41300700001)(4326008)(478600001)(42186006)(8676002)(4744005)(86362001)(26005)(82310400005)(186003)(6266002)(6666004)(356005)(7636003)(83380400001)(2616005)(336012)(7596003)(47076005)(36860700001)(38230200001)(81973001)(23180200003)(14776008)(79816003); DIR:OUT; SFP:1102; X-OriginatorOrg: masteringemacs.org X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 07:25:33.0839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f4368dec-8a6e-4581-490c-08db10b827d4 X-MS-Exchange-CrossTenant-Id: a4e27e3d-bab0-45e8-8942-e64cf9fbd34f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a4e27e3d-bab0-45e8-8942-e64cf9fbd34f; Ip=[178.79.136.144]; Helo=[semantical.co.uk] X-MS-Exchange-CrossTenant-AuthSource: LO2GBR01FT015.eop-gbr01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB5907 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61529 Cc: 61529@debbugs.gnu.org, theo@thornhill.no, Dmitry Gutov 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 (-) Eli Zaretskii writes: >> Date: Thu, 16 Feb 2023 23:34:58 +0200 >> Cc: Eli Zaretskii , 61529@debbugs.gnu.org >> From: Dmitry Gutov >> >> +If no such node is found, but a leaf node ends at POS, it's >> +returned. > > Passive tense alert! This is better: > > If no such node exists, but there's a leaf node which ends at POS, > return that node. Thanks, everyone. I think it's safe to say I misread the intent of the function. It's safe to close this issue. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 17 10:11:12 2023 Received: (at 61529-done) by debbugs.gnu.org; 17 Feb 2023 15:11:12 +0000 Received: from localhost ([127.0.0.1]:41002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT2OG-0002Gk-73 for submit@debbugs.gnu.org; Fri, 17 Feb 2023 10:11:12 -0500 Received: from mail-ed1-f54.google.com ([209.85.208.54]:39919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT2OE-0002GV-CG for 61529-done@debbugs.gnu.org; Fri, 17 Feb 2023 10:11:10 -0500 Received: by mail-ed1-f54.google.com with SMTP id er25so5189764edb.6 for <61529-done@debbugs.gnu.org>; Fri, 17 Feb 2023 07:11:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=P2W2UfAIn0y2o1vtRRfbCCzr/wIYeyuGHhnWoyWWSRI=; b=o2vlfprcDYH62jyUEVbyKao2OwXVqmGUa6ZO+0+U/M6ybL67mhQ0K9+HRlcKNnz6fl MXazICAOX/lF4r/DS0vRiCOY/A18O9goQeB/RXjRpNK9xHNTgVtAkG3E+4NpKaHnoLRg LNoFWWjpT1kk8tstqFz3cZlWiHoftYPfEhgHGk1YWqZgx17HMTqNaNmPhVhqVZnJF3ps m0mjlqNvPP9K7lrCuhXqIdN3xhgQN9+z11bfq7DL++qXy0ybHyHCS31n5kkoxce/GwEe IqGLKzWeQOcf/9n9FQfZuWHRBp2gfzpLMw8EK/rErA71A6nE0wFdL/wLmrSyktcH106h CWig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P2W2UfAIn0y2o1vtRRfbCCzr/wIYeyuGHhnWoyWWSRI=; b=GTrr8J2Rjh9bOfvb7bddfU5m5oKXlYn40yg9P9bw8JY/GXC1EoxDPsb7a3m5+THI6J +J58cyQGh6nEcSvL4F0vW9NFq9P8X3RIT4780yp6eXTQXJ7o+Mc2hYTuJBfB0X9pn/rP zlLa03ROYiBy5CyDcNkrnqxZ5hdl+J+7GmTOFYfCxi71SzzMpyIqEQykHgSv9TN/A/Wq BF2NigusNe/5rJCwdJ0n8hK1vtrod0CstBluy9+BC2WgFU+cPNeZNKXQZZEWQG7jnF67 4rCsCGNxI+P3n6TU9/S+XzuEhIdV9BmL9aHYfNOhe7TJuozo5OII+wEknGvrsyD4f2S+ 5RFw== X-Gm-Message-State: AO0yUKVNJsHhEPpC5qBZG1Ig5cCnZLncrLFkJ/BwHyTqeV1/xXemIM+D wz9jlVaDDQGsggR0pfOxLXc= X-Google-Smtp-Source: AK7set8/hK9TFC4UimGDDgE0UJSbu9KfdkDliSMm1a3AjG+8xNkthPWkw0T55IWhyQqrTvFlIgdsuA== X-Received: by 2002:a17:907:2cc7:b0:8b0:23a6:c491 with SMTP id hg7-20020a1709072cc700b008b023a6c491mr2867646ejc.31.1676646664725; Fri, 17 Feb 2023 07:11:04 -0800 (PST) Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id p13-20020a170907910d00b008af42f87da2sm2243350ejq.79.2023.02.17.07.11.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Feb 2023 07:11:04 -0800 (PST) Message-ID: <89b3f998-e4ba-2270-4dfc-bbe758eaf0a1@yandex.ru> Date: Fri, 17 Feb 2023 17:11:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: bug#61529: 30.0.50; tree-sitter: weird off-by-one error but only in css-ts-mode(?) with `treesit-node-at' Content-Language: en-US To: Eli Zaretskii References: <87mt5fjpwu.fsf@masteringemacs.org> <83v8k3avv8.fsf@gnu.org> <87h6vnjath.fsf@masteringemacs.org> <87cz6a7p5d.fsf@thornhill.no> <4997c960-5a29-1004-6727-df69d22a9d37@yandex.ru> <8335743jge.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <8335743jge.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 61529-done Cc: 61529-done@debbugs.gnu.org, mickey@masteringemacs.org, theo@thornhill.no 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.9 (-) Version: 29.1 On 17/02/2023 08:16, Eli Zaretskii wrote: >> Date: Thu, 16 Feb 2023 23:34:58 +0200 >> Cc: Eli Zaretskii,61529@debbugs.gnu.org >> From: Dmitry Gutov >> >> +If no such node is found, but a leaf node ends at POS, it's >> +returned. > Passive tense alert! This is better: > > If no such node exists, but there's a leaf node which ends at POS, > return that node. Thank you, pushed. With that, I'm closing the report. From unknown Fri Aug 15 17:54:49 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 18 Mar 2023 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator