The error occurs after calling the parser through the language parser.
tree = treesitter.PARSER.parse(read_callable)
ValueError: Parsing failed
The cause of the error is unknown as there is an error after some parsing and not in some.
And sometimes, if I open another document, parse code, and move back into the previous document, it parses fine.
Where the error is produced:
tree = treesitter.PARSER.parse(read_callable)
The read_callable function:
def read_callable(byte_offset, point) -> bytes | None:
"""
Function for reading a document incrementally.
"""
if DOCUMENT is None:
return None
row, column = point
if row >= len(DOCUMENT.lines) or column >= len(DOCUMENT.lines[row]):
return None
return DOCUMENT.lines[row][column:].encode("utf8")
If relevant, the parser is used in the pygls server along with vs code extension client.
I opened this issue in the repo but was instructed to open it here.
tree_sitter version: 0.20.1 language_repo: https://github.com/tree-sitter/py-tree-sitter
The error occurs after calling the parser through the language parser.
The cause of the error is unknown as there is an error after some parsing and not in some. And sometimes, if I open another document, parse code, and move back into the previous document, it parses fine.
Where the error is produced:
The read_callable function:
If relevant, the parser is used in the pygls server along with vs code extension client.
where the code is passed for parsing: https://github.com/Prabigyaa/prabigya-vscode/blob/c126f41ef2b3085fa713af01826961a951dbb9e6/server/src/nlpserver/server.py#L297