Auto indent code

I am new to lezer-python parser.
I am trying to build a python editor using a html textarea. I am able to parse the code with the lezer-python parser
I was wondering how to use the parser to auto indent python code.
For example, if I am at a line like-

if condition:

how can I determine that the next line will be intended when I press ‘Enter’?
I have seen the parser has properties like context and trackIndent. I am not sure how these can be used.

Lezer itself has no auto-indentation feature, but CodeMirror 6 has indentNodeProp (which language packages like @codemirror/lang-python use to define indentation logic) and getIndentation to compute the appropriate indentation at a given position.

@marijn
can you give me an example of how to add an extension that uses indentNodeProp(from @codemirror/lang-python) and getIndentaiton that provides an indentation on moving to the next line in the editor?