Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST depends of order of edit actions. #44

Open
Carreau opened this issue Sep 27, 2023 · 3 comments
Open

AST depends of order of edit actions. #44

Carreau opened this issue Sep 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Carreau
Copy link

Carreau commented Sep 27, 2023

On https://stsewd.dev/tree-sitter-rst/

list:
                                                         
 - item2
 - item2

Parses as

document [0, 0] - [4, 0]
  paragraph [0, 0] - [0, 5]
  block_quote [2, 1] - [3, 8]
    paragraph [2, 1] - [3, 8]

But if you edit the first space of the line in front of item2 and add it again, it becomes

document [0, 0] - [4, 0]
  paragraph [0, 0] - [0, 5]
  block_quote [2, 1] - [2, 8]
    paragraph [2, 1] - [2, 8]
  bullet_list [3, 1] - [3, 8]
    list_item [3, 1] - [3, 8]
      body [3, 3] - [3, 8]
        paragraph [3, 3] - [3, 8]
ts-state.mov

I'll try to have a reproducer via Python API another time. I don't know if it's tree-sitter-rst of tree-sitter bug.

@stsewd
Copy link
Owner

stsewd commented Oct 24, 2023

Hi, sorry for the late reply. This is something I have experience myself while editing files in Neovim. Probably something to do about the parser using (and abusing) an external scanner.

I'll probably need to check if this is a bug on tree-sitter or if there is a better way to communicate to tree-sitter about what nodes should be re-evaluated.

@stsewd stsewd added the bug Something isn't working label Oct 24, 2023
@Carreau
Copy link
Author

Carreau commented Oct 24, 2023

No need to apologize for the delay tree-sitter-rst have been great to use !

@stsewd
Copy link
Owner

stsewd commented Dec 29, 2023

A way to replicate this using the tree-sitter comand is

npm run parse -- --edit '3,0 1' --edit '3,0 0  ' test.rst
list:
                                                         
 - item2
 - item2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants