Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Indentation woes #3302

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open

Conversation

codebykat
Copy link
Member

@codebykat codebykat commented Mar 4, 2025

Fix

In #3216, I changed Monaco's wrappingIndent to none in order to address a request to support hanging indents on paragraphs. Unfortunately this also removes the indentation from lists, making lists less readable.

Some further research in #3053 (comment) but basically I think we were better off with the default of same. There's no way to indent paragraphs, sadly, as even a single space gets matched by the word wrapping algorithm (which is not affected by the settings for detecting indentation settings, tab size, etc.).

Monaco/VS Code does not support these things I've thought of as workarounds:

  • Different word wrap settings for lists and paragraphs
  • Using CSS to apply styling to only the first line
  • Different word wrap settings for different languages
  • Using the tokenizer to adjust the indent size
  • Language settings for indent/outdent applying to the word wrapping indent

Here are some relevant upstream issues: microsoft/monaco-editor#3914, microsoft/vscode#219680, microsoft/vscode#169804, microsoft/vscode#164267

Anyhow, this PR represents a partial revert of #3216, as maybe the least terrible of the available options. I think that indent is a deal-breaker due to representing a serious departure from expectations for long-form writing, whereas a hanging indent on paragraphs is more of a "nice to have" for that use-case. Meanwhile for lists, none is pretty bad, probably(?) worse than the weird behavior of indenting entire paragraphs that we get with same.

Which is a complicated way of saying that same is optimal for lists with word-wrapping, none is optimal for paragraphs, and we can't switch our strategy depending on which it is we have, so we have to pick a side.

Other considerations:

  • An initial indent gets perceived by the Markdown preview renderer as an indication of a code block. List items that aren't indented, and their nested children, are safe -- but indented list items that don't have an un-indented parent are not.
  • The native apps apparently support an initial indent on paragraphs, which then indents the entire paragraph when viewed on web/desktop.

Screenshots

Here are the three options and their trade-offs.

Screenshot 2025-03-04 at 01 03 09

Screenshot 2025-03-04 at 01 34 39

Screenshot 2025-03-04 at 02 26 31

Release

Release notes updated with:

Remove hanging indent support due to its detrimental effect on word-wrapped list items.

n.b. I've added this to a new minor version, 2.23.3, but it could arguably be a hotfix for 2.23.2.

@codebykat codebykat self-assigned this Mar 4, 2025
@codebykat codebykat marked this pull request as ready for review March 4, 2025 08:10
@codebykat codebykat requested review from roundhill and mokagio March 4, 2025 08:11
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.

1 participant