Skip to content

Make new lines in Plaintext and Math blocks and inherit the indentation from the previous line#426

Merged
heyman merged 1 commit intomainfrom
add-indentation-service
Jan 7, 2026
Merged

Make new lines in Plaintext and Math blocks and inherit the indentation from the previous line#426
heyman merged 1 commit intomainfrom
add-indentation-service

Conversation

@heyman
Copy link
Copy Markdown
Owner

@heyman heyman commented Jan 7, 2026

No description provided.

…on from the previous line.

- Adds an indentService to opt certain languages into indentation inheritance.
- Introduces inheritIndentation metadata for languages, defaulted for Plain Text and Math.
- Adds tests
@heyman heyman enabled auto-merge (rebase) January 7, 2026 18:45
@heyman heyman merged commit af71893 into main Jan 7, 2026
3 checks passed
@ItsHarper
Copy link
Copy Markdown
Contributor

Why only those block types? This would be useful for most programming languages, right?

@heyman
Copy link
Copy Markdown
Owner Author

heyman commented Jan 9, 2026

The other parsers should already have this behaviour, as well as additional logic for handling indentation. For example, pressing enter after the following code in a python block will result in the new line getting indented:

def func():

Setting inheritIndentation: true for a language in languages.js will completely override the parser's default indentation settings, so if we would set it for all languages, it would remove the language specific indentation logic like indenting a line after def f(): in python, and after a { in JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants