Fix inheriting indentation containing tabs #7

Closed
jtojnar wants to merge 1 commit from auto-indent-tabs into main
jtojnar commented 2023-06-25 01:22:01 +02:00 (Migrated from github.com)

Pressing Enter key on a line indented with tabs would previously indent the new line with one space for each tab, contrary to what the reference says:

A return value of null indicates no indentation can be determined, and the line should inherit the indentation of the one above it.

This made using many StreamLanguages with tabs annoying, requiring to define a custom indentService facet.

This does not help with mixed indentation (e.g. tabs for indentation + spaces for alignment) but proper support for that would probably require changes to @codemirror/language. People who need it can always implement it later.

Pressing Enter key on a line indented with tabs would previously indent the new line with one space for each tab, contrary to what the reference says: > A return value of null indicates no indentation can be determined, and the line should inherit the indentation of the one above it. This made using many `StreamLanguage`s with tabs annoying, requiring to define a custom `indentService` facet. This does not help with mixed indentation (e.g. tabs for indentation + spaces for alignment) but proper support for that would probably require changes to `@codemirror/language`. People who need it can always implement it later.
marijnh commented 2023-06-26 09:01:06 +02:00 (Migrated from github.com)

Thanks for spotting that. Counting indentation for tabs is a little more complicated than that, but this file is already importing a utility for that purpose, so attached patch makes it use that.

Thanks for spotting that. Counting indentation for tabs is a little more complicated than that, but this file is already importing a utility for that purpose, so attached patch makes it use that.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/commands!7
No description provided.