From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#61369: Problem with keeping tree-sitter parse tree up-to-date Date: Wed, 8 Feb 2023 17:34:25 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25996"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 To: 61369@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 08 16:35:33 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 1pPmTt-0006bf-5W for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Feb 2023 16:35:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPmTT-0001rF-T4; Wed, 08 Feb 2023 10:35:07 -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 1pPmTP-0001qn-RF for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2023 10:35:06 -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 1pPmTP-0001Yx-5c for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2023 10:35:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pPmTO-0003OY-Ll for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2023 10:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Feb 2023 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61369 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167587048013014 (code B ref -1); Wed, 08 Feb 2023 15:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Feb 2023 15:34:40 +0000 Original-Received: from localhost ([127.0.0.1]:56349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPmT0-0003Ni-IH for submit@debbugs.gnu.org; Wed, 08 Feb 2023 10:34:40 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:39434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPmSv-0003NV-6r for submit@debbugs.gnu.org; Wed, 08 Feb 2023 10:34:37 -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 1pPmSs-0001jw-Q4 for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2023 10:34:30 -0500 Original-Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pPmSq-00011O-Ok for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2023 10:34:30 -0500 Original-Received: by mail-ed1-x530.google.com with SMTP id eq11so20982029edb.6 for ; Wed, 08 Feb 2023 07:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:sender:from:to:cc:subject :date:message-id:reply-to; bh=8yqFsIaAtzWlw0v4W8DbnWzPEdLaCuUIMw05yJbF4ho=; b=SzEHqXMDtQCbl8Ggfkoxa8FG+UJZP/7Gobr0E8KT2+iz7olwp4NCdaOjlWZa9EVAyq ZQIRMAuwpPKEEC1znUeRM925NBlHN0C7/0LIPQLySAlQNQFIy/bROe6YIfMtEDW96iOI 1e/JEreWPVFZAVQsfIkkEYNeOfcEoIvnRTSCe/K1sdYiJJeefFYRBpzP9edDguZrG0d4 lkswcsuZf3FYVTZsJofF0bx409yIramg7gJlcSpPWthFEoLZKQBdfrObIFpI7TaBWAVd C8lPjBpxjAulwG/ahV3vbTw9woWFz6Pqhb4Uus03ad/ng1LNg1bgDsxU5k7fR8jN8eGJ VuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8yqFsIaAtzWlw0v4W8DbnWzPEdLaCuUIMw05yJbF4ho=; b=nTD0pLZ10hONZyjWh4geW4LA++j3CBW3ffOzblRPiQK/BKncgpayX3F9ig19z+uM4K S0mp7KouTT+icOzlYt0aZ7T9YO6ij32a1M/qnw/2c6SQhCw3nLfuShCwDE7pjckIWgz9 otTU3KYTHh/e00CbEqGHsNdqTQEbS/EU3SmeUZTiqTMrWIgJcDXLFOAHeZ+FuP84meg/ be4RxPdXhoZCzXvwTBzorLMuZySQLxq4hi2cCg9+/ks7CzBzl6DNV1pqwkSItdfqTtBu t54T0Ug00J764ar8iiTYLUmOcsU9RX/C3XX2p70ym1dqNxmyRKmC3GI4eZfINr4rp/CL +F6g== X-Gm-Message-State: AO0yUKVkFteKJXk8h/wN7EWozVsCb5BE1/108rEfSPxNHwAEENT/c3II KA8UxzOBvYQmF5tdVpDdlv+MbaYznLQ= X-Google-Smtp-Source: AK7set8Y0yDjQAC3THEs6DFDILHcW58fOH/BaChq7Wgg5U7A9xrKUJGlhElstTcnjmqmlhfQJzDNdA== X-Received: by 2002:a50:9b55:0:b0:4aa:b3f2:726c with SMTP id a21-20020a509b55000000b004aab3f2726cmr7697374edj.30.1675870467019; Wed, 08 Feb 2023 07:34:27 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id q20-20020a50c354000000b004aacd6b88ccsm2348171edb.90.2023.02.08.07.34.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Feb 2023 07:34:26 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=raaahh@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:255147 Archived-At: 1. Have some buffer with text "use std::Path::{self, Path, PathBuf}; // good: std is a crate name ... (maybe something else " 2. Have this text in a different buffer (I used scratch): " let date = DateTime::::from_utc(date, chrono::Utc); " Meaning, the buffer starts with two empty lines. 3. Select the first line from the first buffer including the trailing newline, yank and then paste at the beginning of the second buffer. The second buffer will now look like this: "use std::Path::{self, Path, PathBuf}; // good: std is a crate name let date = DateTime::::from_utc(date, chrono::Utc); " The parse tree will, however, be (according to treesit-explore-mode): (source_file (use_declaration use argument: (scoped_use_list path: (scoped_identifier path: (identifier) :: name: (identifier)) :: list: (use_list { (self) , (identifier) , (identifier) })) ;) (line_comment) (let_declaration let pattern: (identifier) = value: (scoped_identifier path: (generic_type type: (type_identifier) :: type_arguments: (type_arguments < (scoped_type_identifier path: (identifier) :: name: (type_identifier)) >)) :: name: (identifier)) (ERROR ( (identifier) , (scoped_identifier path: (identifier) :: name: (identifier)) ;) ;)) But if I edit the buffer after that, e.g. add and remove a space at the beginning, the error node disappears: (source_file (use_declaration use argument: (scoped_use_list path: (scoped_identifier path: (identifier) :: name: (identifier)) :: list: (use_list { (self) , (identifier) , (identifier) })) ;) (line_comment) (let_declaration let pattern: (identifier) = value: (call_expression function: (scoped_identifier path: (generic_type type: (type_identifier) :: type_arguments: (type_arguments < (scoped_type_identifier path: (identifier) :: name: (type_identifier)) >)) :: name: (identifier)) arguments: (arguments ( (identifier) , (scoped_identifier path: (identifier) :: name: (identifier)) ))) ;))