Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Playground: check for nodes out of range (EOF) #47

Merged
merged 1 commit into from
Jul 11, 2021

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jul 9, 2021

The playground will try to set the cursor
to an invalid position (nvim_win_set_cursor) if the node starts at the EOF mark.

def run
  a = <<~EOF
end

found this while debugging nvim-treesitter/nvim-treesitter#1531

The playground will try to set the cursor
to an invalid position (nvim_win_set_cursor) if the node starts at the EOF mark.

```ruby
def run
  a = <<~EOF
end
```
@stsewd stsewd requested a review from theHamsta July 9, 2021 04:38
if start_row > last_row then
start_row = last_row
start_col = last_col
end

M.highlight_nodes(bufnr, { node })
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't error for that type of nodes, so all good.

@vigoux
Copy link
Member

vigoux commented Jul 9, 2021

I am pretty puzzled by this bug tbh.
I think it is up to the parser to not add nodes at the EOF mark.

There is multiple PRs, at multiple places, where we try to address such issues, and that's weird

@stsewd
Copy link
Member Author

stsewd commented Jul 9, 2021

I agree this should be part of the parser, but we should handle those cases gracefully instead of showing errors on every cursor move.

@stsewd
Copy link
Member Author

stsewd commented Jul 9, 2021

Reported this upstream tree-sitter/tree-sitter-ruby#182

@stsewd stsewd merged commit d9a9b44 into nvim-treesitter:master Jul 11, 2021
@stsewd stsewd deleted the check-eof branch July 11, 2021 20:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants