The cause of the error is unknown as there is an error after some compilation and not in some.
And sometimes, if I open another document and parse code and move back into the previous document, it parses fine.
tree_sitter version: 0.20.1
tree = treesitter.PARSER.parse(read_callable)
ValueError: Parsing failed
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 it is relevant, the parser is used in pygls server along with vscode extension client.
The cause of the error is unknown as there is an error after some compilation and not in some. And sometimes, if I open another document and parse code and move back into the previous document, it parses fine.
tree_sitter version: 0.20.1
Where the error is produced:
The read_callable function:
If it is relevant, the parser is used in pygls server along with vscode extension client.
Whole code: https://github.com/Prabigyaa/JS/blob/comment-extraction-python/server/src/nlpserver/comments_extraction_python.py