unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61369: Problem with keeping tree-sitter parse tree up-to-date
@ 2023-02-08 15:34 Dmitry Gutov
  2023-02-08 18:20 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Dmitry Gutov @ 2023-02-08 15:34 UTC (permalink / raw)
  To: 61369

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::<chrono::Utc>::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::<chrono::Utc>::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))
       )))
   ;))





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-02-18 17:21 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 15:34 bug#61369: Problem with keeping tree-sitter parse tree up-to-date Dmitry Gutov
2023-02-08 18:20 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 19:41   ` Dmitry Gutov
2023-02-10  1:22 ` Yuan Fu
2023-02-10  1:38   ` Dmitry Gutov
2023-02-13  9:10 ` Yuan Fu
2023-02-13 23:59 ` Yuan Fu
2023-02-15  2:17   ` Dmitry Gutov
2023-02-15 22:44     ` Dmitry Gutov
2023-02-17 22:32       ` Yuan Fu
2023-02-18  0:11         ` Dmitry Gutov
2023-02-18  1:14           ` Yuan Fu
2023-02-18  1:25             ` Dmitry Gutov
2023-02-18 10:05               ` Yuan Fu
2023-02-18  7:15           ` Eli Zaretskii
2023-02-18 17:21             ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).