typst / webapp-issues

Issue tracker for Typst's web app.
https://typst.app
12 stars 0 forks source link

Configurable indentation #348

Open matj1 opened 4 months ago

matj1 commented 4 months ago

Description

Automatic indentation in the editor is by 2 spaces, and that can't be changed. I would like to be able to configure automatic indentation width in the editor to something fitting the present font and code style.

I would like to use tabs for indentation so the indentation can be shown with the set size without reformatting the source.

I would appreciate being able to set the indentation width relative to the editor font size (like 1 em), so the indentation does not depend on the size of a space in the present font. I think that it would not be very difficult because it can be set in CSS using tab-size (like body {tab-size: 1em;})

Use Case

The present automatic indentation width is too little for me; I use a proportional font with narrow spaces (Recursive), so I would like to have indentation of around 4 spaces. Different people prefer different indentation widths, so having it configurable is best.

Indentation with tabs is useful because the code may be displayed with different fonts, which may have differently wide spaces, so there is no single number of spaces good for indentation in all cases. Tabs have configurable sizes, so the code would be displayed correctly in all cases where the tab size is reasonably set.

If there was a possibility to set the tab size independent of the current font's space width, It could be set once for all fonts. That is relevant if there are multiple fallback fonts (how it is now).

Indentation with Recursive:
Snímek obrazovky z 2024-05-14 12-02-23