indentSelection

Auto-indent the lines touched by the selection, replacing each line's existing leading whitespace with the indentation computed by the language's getIndentation (indent service / tree strategy).

Lines for which getIndentation returns null (no opinion) are left untouched. When the cursor sits within a line's old indentation, it is moved to the end of the new indentation, matching upstream @codemirror/commands indentSelection.

Note: unlike upstream, kodemirror's getIndentation does not yet support the overrideIndentation option, so tree-based strategies see the pre-change indentation of earlier lines when re-indenting a block. The end result is applied in a single transaction with the selection remapped.